perf, tools, stat: Implement --metric-only mode
Add a new mode to only print metrics. Sometimes we don't care about
the raw values, just want the computed metrics. This allows more
compact printing, so with -I each sample is only a single line.
This also allows easier plotting and processing with other tools
because the output is normalized.
A few metrics are not supported and it does not support all
output modes (like -A and --per-thread), but works for all
the others.
To avoiding having to hardcode all the metrics in the code it uses
a two pass approach: first compute dummy metrics and only
print the headers in the print_metric callback. Then use the callback
to print the actual values. There are some additional changes
in the stat printout code to handle all metrics being on a single line.
Example:
% perf stat -a -I 1000 --metric-only
1.001402499 frontend cycles idle backend cycles idle insn per cycle stalled cycles per insn
1.001402499 168.38% - 0.35 4.77
2.002257235 183.18% - 0.47 3.64
3.003652261 155.27% - 0.38 4.49
Signed-off-by: Andi Kleen <ak@linux.intel.com>
2 files changed