From 962848142335e8b35d522be78f58f2011d976b17 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Mon, 20 Mar 2017 13:17:10 -0700 Subject: perf pmu: Add support for MetricName JSON attribute Add support for a new JSON event attribute to name MetricExpr for better output in perf stat. If the event has no MetricName it uses the normal event name instead to describe the metric. Before % perf stat -a -I 1000 -e '{unc_p_clockticks,unc_p_freq_max_os_cycles}' --metric-only time unc_p_freq_max_os_cycles 1.000149775 15.7 2.000344807 19.3 3.000502544 16.7 4.000640656 6.6 5.000779955 9.9 After % perf stat -a -I 1000 -e '{unc_p_clockticks,unc_p_freq_max_os_cycles}' --metric-only time freq_max_os_cycles % 1.000149775 15.7 2.000344807 19.3 3.000502544 16.7 4.000640656 6.6 5.000779955 9.9 Signed-off-by: Andi Kleen Acked-by: Jiri Olsa Link: http://lkml.kernel.org/r/20170320201711.14142-13-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/pmu.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools/perf/util/pmu.h') diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 27f078ccc594..3d4b703f5d89 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h @@ -32,6 +32,7 @@ struct perf_pmu { struct perf_pmu_info { const char *unit; const char *metric_expr; + const char *metric_name; double scale; bool per_pkg; bool snapshot; @@ -52,6 +53,7 @@ struct perf_pmu_alias { bool per_pkg; bool snapshot; char *metric_expr; + char *metric_name; }; struct perf_pmu *perf_pmu__find(const char *name); -- cgit v1.2.3-59-g8ed1b