Search code examples
perf

What are the columns in perf-stat when run with -r and -x


I'm trying to interpret the results of perf-stat run on a program. I know that it was run with -r 30 and -x. From https://perf.wiki.kernel.org/index.php/Tutorial is says that if run with -r the stddev will be reported but I'm not sure which of these columns that is and I'm having trouble finding information on the output when run with -x. One example of the output I've recieved is this

19987,,cache-references,0.49%,562360,100.00                                                                    
256,,cache-misses,10.65%,562360,100.00                                                                                 
541747,,branches,0.07%,562360,100.00                                                                                                   
7098,,branch-misses,0.78%,562360,100.00                                                                        
60,,page-faults,0.43%,560411,100.00                                                                            
0.560244,,cpu-clock,0.28%,560411,100.00                                                                        
0.560412,,task-clock,0.28%,560411,100.00

My guess is that the % column is the standard deviation as a percentage of the first column but I'm not sure.

My question in summary is what do the columns represent? Which column is the standard deviation?


Solution

  • You are very close. Here are some blanks filled in.

    1. Arithmetic mean of the measured values.
    2. The unit if known. E.g. on my system it shows 'msec' for 'cpu-clock'.
    3. Event name
    4. Standard deviation scaled to 100% = mean
    5. Time during which counting this event was actually running
    6. Fraction of enabled time during which this event was actually running (in %)

    The last two are relevant for multiplexing: If there are more counters selected than can be recorded concurrently, the denoted percentage will drop below 100.

    On my system (Linux 5.0.5, not sure since when this is available), there is also a shadow stat for some metrics which compute a derived metric. For example the cpu-clock will compute CPUs utilized or branch-misses computes the fraction of all branches that are missed.

    1. Shadow stat value
    2. Shadow stat description

    Note that this format changes with some other options. For example if you display the metrics with a more fine granular grouping (e.g. per cpu), information about these groups will be prepended in additional columns.