Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can perf display raw sample counts?

I'd like perf to output raw sample counts rather than percentages. This is useful for determining whether I've sped up a function I'm trying to optimize.

To be clear, I'd like to do something like

perf record ./a.out
perf report

and see how many times perf sampled each function in a.out.

Shark can do this on Mac, as can (I believe) Xperf. Is this possible on Linux with perf?

like image 523
Justin L. Avatar asked Sep 02 '10 20:09

Justin L.


People also ask

What is perf used for?

The perf command is used as a primary interface to the Linux kernel performance monitoring capabilities and can record CPU performance counters and trace points.

What is perf record?

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 was hit.

What is overhead in perf report?

Sampling with perf record The report contains 4 columns, which have their own specific meaning: Overhead: the percentage of overall samples collected in the corresponding function. Command: the command to which the samples belong.


1 Answers

perf report (version 2.6.35.7) now supports the -n flag, which does what I want.

like image 50
Justin L. Avatar answered Sep 24 '22 14:09

Justin L.