Commit-ID: 5fde2523bddb71d96f12b6ee8d2a9a43cb99da96 Gitweb: http://git.kernel.org/tip/5fde2523bddb71d96f12b6ee8d2a9a43cb99da96 Author: Namhyung Kim <namhyung.kim@xxxxxxx> AuthorDate: Mon, 6 Feb 2012 16:44:44 +0900 Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> CommitDate: Mon, 6 Feb 2012 19:17:11 -0200 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@xxxxxxx> Cc: Namhyung Kim <namhyung@xxxxxxxxx> Cc: Paul Mackerras <paulus@xxxxxxxxx> Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> Link: http://lkml.kernel.org/r/1328514285-26232-1-git-send-email-namhyung.kim@xxxxxxx Signed-off-by: Namhyung Kim <namhyung.kim@xxxxxxx> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> --- tools/perf/builtin-stat.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 459b862..32d930e 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -844,12 +844,18 @@ static void abs_printout(int cpu, struct perf_evsel *evsel, double avg) fprintf(output, " # %8.3f GHz ", ratio); } else if (runtime_nsecs_stats[cpu].n != 0) { + char unit = 'M'; + total = avg_stats(&runtime_nsecs_stats[cpu]); if (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 { fprintf(output, " "); } -- To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
![]() |