Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Read and parse perf.data

I am recording a performance counters frm linux using the command perf record.

I want to use the result perf.data as an input to other programming apps. Do you know how shall I read and parse the data in perf.data? Is there a way to transform it to .text file or .csv?

like image 284
Mohamad Ibrahim Avatar asked Aug 12 '12 11:08

Mohamad Ibrahim


People also ask

How do I read a perf data file?

There is builtin perf. data parser and printer in perf tool of linux tools with subcommand "script". perf-script - Read perf. data (created by perf record) and display trace output This command reads the input file and displays the trace recorded.

What is perf script?

Description. This command reads the input file and displays the trace recorded. There are several variants of perf script: 'perf script' to see a detailed trace of the workload that was recorded.


2 Answers

There is builtin perf.data parser and printer in perf tool of linux tools with subcommand "script".

To convert perf.data file

perf script > perf.data.txt

To convert output of perf record in other file (perf record -o filename.data) use -i option:

perf script -i filename.data > filename.data.txt

perf script is documented at man perf-script, available online at http://man7.org/linux/man-pages/man1/perf-script.1.html

   perf-script - Read perf.data (created by perf record) and display
   trace output

   This command reads the input file and displays the trace recorded.

       'perf script' to see a detailed trace of the workload that was
       recorded.
like image 176
osgx Avatar answered Oct 01 '22 11:10

osgx


The quipper sub-project of https://github.com/google/perf_data_converter can parse perf.data files.

like image 42
mhansen Avatar answered Oct 01 '22 10:10

mhansen