提交 777d1d71 编写于 作者: S Stephane Eranian 提交者: Arnaldo Carvalho de Melo

perf tools: Fix error handling of unknown events

There was a problem with the parse_events() code not printing the
correct event name when an event was unknown and starting with an 'r'.
The source of the problem was the way raw notation was parsed.

Without the patch:
	$ perf stat -e retired_foo
	invalid event modifier: 'tired_foo'

With the patch:
	$ perf stat -e retired_foo
	invalid or unsupported event: 'retired_foo'

This also covers the case where the name of the event was not printed at
all when perf was linked with libpfm4.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20110723021043.GA20178@quadSigned-off-by: NStephane Eranian <eranian@google.com>
Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 cc2d86b0
...@@ -697,7 +697,11 @@ parse_raw_event(const char **strp, struct perf_event_attr *attr) ...@@ -697,7 +697,11 @@ parse_raw_event(const char **strp, struct perf_event_attr *attr)
return EVT_FAILED; return EVT_FAILED;
n = hex2u64(str + 1, &config); n = hex2u64(str + 1, &config);
if (n > 0) { if (n > 0) {
*strp = str + n + 1; const char *end = str + n + 1;
if (*end != '\0' && *end != ',' && *end != ':')
return EVT_FAILED;
*strp = end;
attr->type = PERF_TYPE_RAW; attr->type = PERF_TYPE_RAW;
attr->config = config; attr->config = config;
return EVT_HANDLED; return EVT_HANDLED;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册