mirror of
https://gitee.com/openharmony/arkcompiler_runtime_core
synced 2024-11-23 06:40:32 +00:00
c658ccf319
Issue: https://gitee.com/openharmony/arkcompiler_runtime_core/issues/I5G96F Test: Test262 suit, ark unittest, rk3568 XTS, ark previewer demo Signed-off-by: huangyu <huangyu76@huawei.com> Change-Id: I3f63d129a07deaa27a390f556dcaa5651c098185
1.2 KiB
1.2 KiB
Panda Tracing
This document describes Panda trace subsystem. The subsystem provides API for creating tracepoints to track key points in the runtime. The subsystem uses the ftrace
ring buffer to record the trace.
API
Trace API is described in libpandabase/trace/trace.h file. It supports tracing a scope execution time and tracking a parameter value.
Usage examples:
...
#include "trace/trace.h"
...
void FunctionA() {
trace::ScopedTrace scoped_trace("Loading file");
...
}
void FunctionB() {
trace::ScopedTrace scoped_trace(__func__);
...
}
void FunctionC() {
SCOPED_TRACE_STREAM << "Trace: " << __func__;
...
}
void FunctionD() {
trace::BeginTracePoint(__func__);
...
trace::EndTracePoint();
}
void FunctionE(int allocated_bytes) {
trace::IntTracePoint("Heap Size", allocated_bytes);
...
}
Recording trace
To record and view a trace, do the following steps:
- Enable tracing by the command:
sudo scripts/trace_enable.sh <output_file> <trace_time_in_seconds>
- Launch the runtime with extra environment variable:
PANDA_TRACE=1 panda <args>
- Stop tracing by ^C if the trace time is still running out.
- Load <output_file> in Chrome at
chrome://tracing
address.