diff options
author | Jiri Olsa <jolsa@kernel.org> | 2015-10-05 15:31:17 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-10-05 16:59:50 -0400 |
commit | 27bf90bf0690f55c3679bcc4c325823cf1cfd19d (patch) | |
tree | df5ec1da23e37e944805a4ca37021fdc2a9ac4aa /tools/perf/util/parse-events.c | |
parent | c6c3c02dea4034431110923ffd8e296ebfbdbe1b (diff) |
perf tools: Fail properly in case pattern matching fails to find tracepoint
Currently we dont fail properly when pattern matching fails to find any
tracepoint.
Current behaviour:
$ perf record -e 'sched:krava*' sleep 1
WARNING: event parser found nothinginvalid or unsupported event: 'sched:krava*'
Run 'perf list' for a list of valid events
usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
This patch change:
$ perf record -e 'sched:krava*' sleep 1
event syntax error: 'sched:krava*'
\___ unknown tracepoint
Error: File /sys/kernel/debug/tracing/events/sched/krava* not found.
Hint: Perhaps this kernel misses some CONFIG_ setting to enable this feature?.
Run 'perf list' for a list of valid events
usage: perf record [<options>] [<command>]
or: perf record [<options>] -- <command> [<options>]
Reported-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1444073477-3181-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/parse-events.c')
-rw-r--r-- | tools/perf/util/parse-events.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 3ed8bf175163..991bbd469bea 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -449,7 +449,7 @@ static int add_tracepoint_multi_event(struct list_head *list, int *idx, | |||
449 | char evt_path[MAXPATHLEN]; | 449 | char evt_path[MAXPATHLEN]; |
450 | struct dirent *evt_ent; | 450 | struct dirent *evt_ent; |
451 | DIR *evt_dir; | 451 | DIR *evt_dir; |
452 | int ret = 0; | 452 | int ret = 0, found = 0; |
453 | 453 | ||
454 | snprintf(evt_path, MAXPATHLEN, "%s/%s", tracing_events_path, sys_name); | 454 | snprintf(evt_path, MAXPATHLEN, "%s/%s", tracing_events_path, sys_name); |
455 | evt_dir = opendir(evt_path); | 455 | evt_dir = opendir(evt_path); |
@@ -468,10 +468,17 @@ static int add_tracepoint_multi_event(struct list_head *list, int *idx, | |||
468 | if (!strglobmatch(evt_ent->d_name, evt_name)) | 468 | if (!strglobmatch(evt_ent->d_name, evt_name)) |
469 | continue; | 469 | continue; |
470 | 470 | ||
471 | found++; | ||
472 | |||
471 | ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name, | 473 | ret = add_tracepoint(list, idx, sys_name, evt_ent->d_name, |
472 | err, head_config); | 474 | err, head_config); |
473 | } | 475 | } |
474 | 476 | ||
477 | if (!found) { | ||
478 | tracepoint_error(err, ENOENT, sys_name, evt_name); | ||
479 | ret = -1; | ||
480 | } | ||
481 | |||
475 | closedir(evt_dir); | 482 | closedir(evt_dir); |
476 | return ret; | 483 | return ret; |
477 | } | 484 | } |