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.
Answer from osgx on Stack Overflow
🌐
Brendan Gregg
brendangregg.com › perf.html
Linux perf Examples
A perf record command was used to trace the block:block_rq_issue probe, which fires when a block device I/O request is issued (disk I/O). Options included -a to trace all CPUs, and -g to capture call graphs (stack traces). Trace data is written to a perf.data file, and tracing ended when Ctrl-C ...
🌐
Linux Man Pages
man7.org › linux › man-pages › man1 › perf-data.1.html
perf-data(1) - Linux manual page
Data file related processing. convert Converts perf data file into another format.
🌐
Nagios
assets.nagios.com › downloads › nagioscore › docs › nagioscore › 3 › en › perfdata.html
Performance Data
Everything after the pipe character is considered to be the plugin-specific performance data and will be stored in the $HOSTPERFDATA$ or $SERVICEPERFDATA$ macro · In the example above, the $HOSTOUTPUT$ or $SERVICEOUTPUT$ macro would contain "PING ok - Packet loss = 0%, RTA = 0.80 ms" (without quotes) and the $HOSTPERFDATA$ or $SERVICEPERFDATA$ macro would contain "percent_packet_loss=0, rta=0.80" (without quotes). Multiple lines of performace data (as well as normal text output) can be obtained from plugins, as described in the plugin API documentation.
🌐
GitHub
github.com › mstange › linux-perf-data
GitHub - mstange/linux-perf-data: A parser for the perf.data format · GitHub
The data section contains the main content of the file: a sequence of records. There are two types of records: event records from the kernel, and "user records" from perf / simpleperf.
Starred by 40 users
Forked by 11 users
Languages   Rust
🌐
Linux Man Pages
linux.die.net › man › 1 › perf-report
perf-report(1): Read perf.data/display profile - Linux man page
This command displays the performance counter profile information recorded via perf record.
Find elsewhere
🌐
GitHub
github.com › benjamingroeber › perfdata
GitHub - benjamingroeber/perfdata: Parsing and creating monitoring check performance data from and for monitoring engines
This library was created to fit basic needs for parsing and creating Performance Data commonly used by check commands from monitoring engines like Icinga2 or Nagios.
Author   benjamingroeber
🌐
GitHub
github.com › KDAB › hotspot
GitHub - KDAB/hotspot: The Linux perf GUI for performance analysis. · GitHub
To do off-CPU analysis with Hotspot, you need to record the data with a very specific command: perf record \ -e cycles \ # on-CPU profiling -e sched:sched_switch --switch-events \ # off-CPU profiling --sample-cpu \ # track on which core code is executed -m 8M \ # reduce chance of event loss --aio -z \ # reduce disk-I/O overhead and data size --call-graph dwarf \ # we definitely want backtraces <your application>
Starred by 5.1K users
Forked by 287 users
Languages   C++ 92.1% | CMake 3.4% | Python 1.4% | Shell 1.3% | Dockerfile 1.1% | C 0.7%
🌐
Maine
web.eece.maine.edu › ~vweaver › projects › perf_events › perf_data
Parsing the perf_event perf.data file format
The perf tool stores sampled data in the perf.data format. This can be used by perf report and possibly other tools for analysis. The perf.data file format is complex. I have been working on updating the tools/perf/Documentation/perf.data-file-format.txt found in the Linux kernel tree which seems to be the most up-to-date source of the file layout.
🌐
Arch Linux Man Pages
man.archlinux.org › man › perf-data.1.en
perf-data(1) — Arch manual pages
Data file related processing. ... Converts perf data file into another format.
🌐
Python documentation
docs.python.org › 3 › howto › perf_profiling.html
Python support for the Linux perf profiler — Python 3.14.6 documentation
perf inject --jit command will read perf.data, automatically pick up the perf dump file that Python creates (in /tmp/perf-$PID.dump), and then create perf.jit.data which merges all the JIT information together. It should also create a lot of jitted-XXXX-N.so files in the current directory which are ELF images for all the JIT trampolines that were created by Python. ... When using --call-graph dwarf, the perf tool will take snapshots of the stack of the process being profiled and save the information in the perf.data file.
🌐
Linux Man Pages
man7.org › linux › man-pages › man1 › perf-report.1.html
perf-report(1) - Linux manual page
This command displays the performance counter profile information recorded via perf record. -i, --input= Input file name. (default: perf.data unless stdin is a fifo) -v, --verbose Be more verbose. (show symbol address, etc) -q, --quiet Do not show any warnings or messages.
🌐
LWN.net
lwn.net › Articles › 644919
perf.data file format specification draft [LWN.net]
Thanks, -Andi --- perf.data format This document describes the on-disk perf.data format, generated by perf record or perf inject and consumed by the other perf tools. On a high level perf.data contains the events generated by the PMUs, plus metadata. All fields are in native-endian of the machine ...
🌐
Ubuntu
manpages.ubuntu.com › trusty › man(1)
Ubuntu Manpage: perf-report - Read perf.data (created by perf record) and display the profile
Use the addresses of sampled taken branches instead of the instruction address to build the histograms. To generate meaningful output, the perf.data file must have been obtained using perf record -b or perf record --branch-filter xxx where xxx is a branch filter option.
🌐
Reddit
reddit.com › r/linuxquestions › perf data information
r/linuxquestions on Reddit: perf data information
March 6, 2024 -

Hi guys i am new to profiling and perf command and i was wondering what all these data i am getting from when i run
"perf record -g ./app"

"perf script > out.perf"

like what is the "382158" and cycles:p are if there is any refrence for this please help me out

Top answer
1 of 1
2
i was wondering what all these data i am getting By default, as the superuser, the event list for perf record is cycles:P. This kind of event needs to be sampled. The kernel configures the hardware to issue a performance monitoring interrupt periodically. When handling that interrupt, the kernel reads the CPU cycles counter to determine what the counter's value is, and what CPU instruction that was being executed. You have told perf record to also record the call graph at each of those samples. The P flag in the event list is related to a concept called "skid". There can be a small delay between the hardware's performance monitoring counter overflowing and the performance monitoring interrupt being raised. This can mean the recorded instruction can be somewhat after the location where the sample should have occurred. To counteract this, on some architectures the instruction pointer can be automatically recorded into a buffer as the performance PM counter overflows. Intel calls this PEBS: Precise Event-Based Sampling. There are various levels to which this precision can be guaranteed. For instance, on some systems it may be possible to shrink the skid to zero and have the instruction pointer recorded precisely. On others you might only be able to get by with a constant amount of skid, or perhaps a bounded amount of skid. The P flag tells the perf system in the kernel that it should try to use the "best" possible mitigation strategy against skid that the architecture provides. I don't think perf script is a particularly good way to analyse this collected data. perf report might be better. But for something a lot simpler, I would recommend starting off with: perf stat instead. if there is any refrence for this No, don't be ridiculous. It's a userspace tool written by kernel developers, so its interface is horrible and its documentation is poor.