OSDN Git Service

perf pmu: Improve error messages for missing PMUs
authorAndi Kleen <ak@linux.intel.com>
Wed, 13 Sep 2017 21:50:06 +0000 (14:50 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 18 Sep 2017 12:40:20 +0000 (09:40 -0300)
commit333b566559019b146905c623bde7f455c1d5add3
tree5a55781d107265752784ba23a2257e18bd922bd1
parent75e45e432052c7b1a5da866cff88192db8be1445
perf pmu: Improve error messages for missing PMUs

When a PMU is missing print a better error message mentioning
the missing PMU.

% mkdir empty
% mount --bind empty /sys/devices/msr
% perf stat -M Summary true
event syntax error: '{inst_retired.any,cycles}:W,{cpu_clk_unhalted.thread}:W,{inst_retired.any}:W,{cpu_clk_unhalted.ref_tsc,msr/tsc/}:W,{fp_comp_ops_exe.sse_scalar..'
                     \___ Cannot find PMU `msr'. Missing kernel support?

It still cannot find the right column for aliases, but it's already a vast improvement.

v2: Check asprintf

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20170913215006.32222-1-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/metricgroup.c
tools/perf/util/parse-events.c
tools/perf/util/parse-events.h