Perf records samples and stores tracing data in a file. The raw timestamped trace data can be seen with the following:
# perf script
After executing the command we get the following output:
As we have seen, we can use perf report to look at the sampled data formatted for profiling analysis, but we can also generate Python scripts that we can then modify to change the way the data is presented, by running the following line of code:
# perf script -g python
This will generate a perf-script.py script that looks as follows:
To run the script, use the following command:
# perf script -s perf-script.py
For the previous command to work, you need to install the perf-python package in our target image. You can add this to your image with the following line in the conf/local.conf file:
IMAGE_INSTALL_append = " perf-python"
Now you will get a similar output as with the perf script earlier, but now you can modify the print statements in the Python code to post-process the sampled data to your specific needs.