Commit 5fde2523 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf stat: Adjust print unit

The default 'M/sec' unit is not useful if the result is small enough.

Adjust it dynamically according to the value.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1328514285-26232-1-git-send-email-namhyung.kim@lge.comSigned-off-by: default avatarNamhyung Kim <namhyung.kim@lge.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 762b2935
...@@ -844,12 +844,18 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg) ...@@ -844,12 +844,18 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg)
fprintf(output, " # %8.3f GHz ", ratio); fprintf(output, " # %8.3f GHz ", ratio);
} else if (runtime_nsecs_stats[cpu].n != 0) { } else if (runtime_nsecs_stats[cpu].n != 0) {
char unit = 'M';
total = avg_stats(&runtime_nsecs_stats[cpu]); total = avg_stats(&runtime_nsecs_stats[cpu]);
if (total) if (total)
ratio = 1000.0 * avg / total; ratio = 1000.0 * avg / total;
if (ratio < 0.001) {
ratio *= 1000;
unit = 'K';
}
fprintf(output, " # %8.3f M/sec ", ratio); fprintf(output, " # %8.3f %c/sec ", ratio, unit);
} else { } else {
fprintf(output, " "); fprintf(output, " ");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment