ftrace: output through GPIO

185 views Asked by At

I am doing some research and need to collect all the kernel function calls within a certain time span, e.g. 60 seconds. I am using Raspberry Pi 4B. I've tried to use the function tracer ftrace and read the trace_pipe via

echo function > current_tracer
echo 1 > tracing_on
cat trace_pipe > /home/pi/trace/test.txt

This method seems to be too slow and too much data gets lost due to overfilled buffer: approx. 50-60M data points get lost and I only get about 3 M data points. So that's not a good statistics.

I also tried to use trace-cmd:

trace-cmd record -p function sleep 60

With trace-cmd about 20 M data points get lost, which is much better, but still not good enough to build a good statistics. Furthermore the file I get by doing

trace-cmd report > /home/pi/trace/test_trace-cmd.txt

is about 5-6 Gb and takes a few minutes to write. I don't have an intention to make this file smaller (I assume it is impossible). But I just can't wait for so long. I also worry about producing too much overhead to the system by saving such big trace files. Is it the case?

I am wondering, if it would possible to direct the output of the trace_pipe (or maybe of some other tracing file) to some I/O pin, so that I can connect some logic analyser to this pin and read the data flow by some other device? There will be no need to save the tracing file on the raspberry itself then. I also hope I can reduce the amount of data getting lost.

0

There are 0 answers