Skip to content

Latest commit

 

History

History
78 lines (51 loc) · 1.6 KB

tracing.md

File metadata and controls

78 lines (51 loc) · 1.6 KB

Tracing

Build

Add --define=profiling=1 to build arguments

bazel build --define=profiling=1 -c opt //...

Profile

Perform the operations to trace, and the trace file is generated

Trace file: livehd.trace in current working directory

View trace

Add new events

Include perf_tracing.hpp

#include "perf_tracing.hpp"

RAII

{
    TRACE_EVENT(category, event);
    ...
}

Events that don't follow function scoping

TRACE_EVENT_BEGIN(category, event);
...
TRACE_EVENT_END(category);

Events with a runtime name

(category, nullptr, [&name](perfetto::EventContext ctx) {
                        ctx.event()->set_name(name); 
                    }
);

Add new categories

In core/perf_tracing.hpp, add to PERFETTO_DEFINE_CATEGORIES

perfetto::Category(category).SetDescription(description)

System mode

Inside the tmux window, there will be a command to launch the tracing session

Perform the operations to trace while session is on, and the trace file is generated

Trace file: trace in temporary directory

References