From: Paul A. Clarke Date: Thu, 7 May 2020 14:18:07 +0000 (-0500) Subject: perf stat: Increase perf metric output resolution X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d4d5ca0baac3de82c00ebc7677ee84537c31ba3c;p=linux.git perf stat: Increase perf metric output resolution Add another digit of precision to the perf metrics output. Before: $ /usr/bin/perf stat --metrics run_cpi /bin/ls [...] 4,345,526 pm_run_cyc # 1.1 run_cpi 3,818,069 pm_run_inst_cmpl [...] $ /usr/bin/perf stat --metrics run_cpi --metric-only /bin/ls [...] run_cpi 1.1 [...] After: $ perf stat --metrics run_cpi /bin/ls [...] 4,280,882 pm_run_cyc # 1.12 run_cpi 3,817,016 pm_run_inst_cmpl [...] $ perf stat --metrics run_cpi --metric-only /bin/ls [...] run_cpi 1.06 [...] Cc: Andi Kleen Cc: Jin Yao Cc: Jiri Olsa Cc: Kan Liang Cc: Namhyung Kim Signed-off-by: Paul Clarke LPU-Reference: 1588861087-31280-1-git-send-email-pc@us.ibm.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c index 129b8c5f25389..9bd7a8d2a8589 100644 --- a/tools/perf/util/stat-shadow.c +++ b/tools/perf/util/stat-shadow.c @@ -797,7 +797,7 @@ static void generic_metric(struct perf_stat_config *config, print_metric(config, ctxp, NULL, "%8.1f", metric_bf, ratio); } else { - print_metric(config, ctxp, NULL, "%8.1f", + print_metric(config, ctxp, NULL, "%8.2f", metric_name ? metric_name : out->force_header ? name : "",