Large targets quick-start¶
Tracing quick-start for targets with plenty of storage, i.e. ia32-generic,
riscv64-generic, armv7a7-imx6ull, etc.
Objectives¶
Record the trace on your target
Retrieve trace output directory from your target to host PC
Pass the directory to
convert.shto get a single file readable by Perfetto Trace ViewerOpen the trace file in the Perfetto GUI
Prerequisites¶
Aside from Common prerequisites, you need:
A way of transporting files from your target to host PC (likely platform-dependent)
Step 1: record the trace¶
You can use libtrace library from phoenix-rtos-corelibs or use psh applet
perf:
perf
The minimal invocation is:
perf -m trace -o my_trace
This starts a trace for 3 seconds and captures it periodically (each 100 ms) to
my_trace directory. You can fine-tune the priority of the applet with -p,
change the sleeptime to alter periodical reads with -s or modify the capture
buffer size.
A successful invocation:
perf -m trace -o my_trace
Note
If you notice something like:
trace: warning: read buffer was fully utilized during perf_read - read rate may be too slow
This means the perf applet couldn’t keep up with the rate of event emission.
Increase the buffer size -b (just remember that it is an exponential
parameter) or decrease the sleep time -s.
Step 2: gather the trace from target to host¶
This step is mostly up to you as the means to do it are rather target-specific. If you are gathering the trace on some QEMU target though, see Obtaining trace from QEMU MBR disk image.
Your objective here is to acquire a directory structured like the following and have it on host PC:
tree my_trace
Example explanation: This is from ia32-generic-qemu target run with 4 cores,
hence 8 channels - 1 meta + 1 event per core
Step 3: invoke convert.sh¶
Once you have your trace on host in a folder, say $TRACE_DIR, you can now
invoke:
cd $PRTOS_PROJECT/phoenix-rtos-hostutils/trace ./convert.sh $TRACE_DIR $PRTOS_PROJECT/phoenix-rtos-kernel/perf/tsdl/metadata out.pftrace
The resulting out.pftrace is ready to be opened in Perfetto.