perf stat: Increase perf metric output resolution
authorPaul A. Clarke <pc@us.ibm.com>
Thu, 7 May 2020 14:18:07 +0000 (09:18 -0500)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 28 May 2020 13:03:25 +0000 (10:03 -0300)
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 <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Paul Clarke <pc@us.ibm.com>
LPU-Reference: 1588861087-31280-1-git-send-email-pc@us.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/stat-shadow.c

index 129b8c5f2538925245f57a727851e9ce24bbe08e..9bd7a8d2a858985ec1facada22f5e951278f2199 100644 (file)
@@ -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 : "",