Commit 3ae9a34d747f9abf2bcc85dc0e77b951513ccdf2
Committed by
Ingo Molnar
1 parent
343a031f3c
Exists in
master
and in
4 other branches
perf stat: Add noise output for csv mode
Previously, when you want perf-stat to output the statistics in csv mode, no information of the noise will be printed out. For example right now we output this --repeat information: ./perf stat -r3 -x, sleep 1 1.164789,task-clock 8,context-switches 0,CPU-migrations 219,page-faults 3337800,cycles With this patch, the output will be appended with an additional entry for the noise value: ./perf stat -r3 -x, sleep 1 1.164789,task-clock,3.75% 8,context-switches,75.00% 0,CPU-migrations,100.00% 219,page-faults,0.00% 3337800,cycles,3.36% Signed-off-by: Zhengyu He <zhengyuh@google.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Cc: Stephane Eranian <eranian@google.com> Cc: Venkatesh Pallipadi <venki@google.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Frederic Weisbecker <fweisbec@gmail.com> Link: http://lkml.kernel.org/r/1308861942-4945-1-git-send-email-zhengyuh@google.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff
tools/perf/builtin-stat.c
... | ... | @@ -517,7 +517,10 @@ |
517 | 517 | if (avg) |
518 | 518 | pct = 100.0*total/avg; |
519 | 519 | |
520 | - fprintf(stderr, " ( +-%6.2f%% )", pct); | |
520 | + if (csv_output) | |
521 | + fprintf(stderr, "%s%.2f%%", csv_sep, pct); | |
522 | + else | |
523 | + fprintf(stderr, " ( +-%6.2f%% )", pct); | |
521 | 524 | } |
522 | 525 | |
523 | 526 | static void print_noise(struct perf_evsel *evsel, double avg) |
524 | 527 | |
... | ... | @@ -882,12 +885,12 @@ |
882 | 885 | else |
883 | 886 | abs_printout(-1, counter, avg); |
884 | 887 | |
888 | + print_noise(counter, avg); | |
889 | + | |
885 | 890 | if (csv_output) { |
886 | 891 | fputc('\n', stderr); |
887 | 892 | return; |
888 | 893 | } |
889 | - | |
890 | - print_noise(counter, avg); | |
891 | 894 | |
892 | 895 | if (scaled) { |
893 | 896 | double avg_enabled, avg_running; |