path: root/tools/perf/builtin-stat.c
diff options
authorWang Nan <>2016-02-19 11:43:58 +0000
committerArnaldo Carvalho de Melo <>2016-02-19 19:12:49 -0300
commit1669e509ea25e4e3e871d913d21b1cac4a96d1e8 (patch)
treefa035bfba42449b302ac41445b4785352903badb /tools/perf/builtin-stat.c
parent17cb5f84b89fd39a143f1c899836f40420a6b799 (diff)
perf stat: Bail out on unsupported event config modifiers
'perf stat' accepts some config terms but doesn't apply them. For example: # perf stat -e 'instructions/no-inherit/' -e 'instructions/inherit/' bash # ls # exit Performance counter stats for 'bash': 266258061 instructions/no-inherit/ 266258061 instructions/inherit/ 1.402183915 seconds time elapsed The result is confusing, because user may expect the first 'instructions' event exclude the 'ls' command. This patch forbid most of these config terms for 'perf stat'. Result: # ./perf stat -e 'instructions/no-inherit/' -e 'instructions/inherit/' bash event syntax error: 'instructions/no-inherit/' \___ 'no-inherit' is not usable in 'perf stat' ... We can add blocked config terms back when 'perf stat' really supports them. This patch also removes unavailable config term from error message: # ./perf stat -e 'instructions/badterm/' ls event syntax error: 'instructions/badterm/' \___ unknown term valid terms: config,config1,config2,name # ./perf stat -e 'cpu/badterm/' ls event syntax error: 'cpu/badterm/' \___ unknown term valid terms: pc,any,inv,edge,cmask,event,in_tx,ldlat,umask,in_tx_cp,offcore_rsp,config,config1,config2,name Signed-off-by: Wang Nan <> Tested-by: Arnaldo Carvalho de Melo <> Cc: Adrian Hunter <> Cc: Alexei Starovoitov <> Cc: Brendan Gregg <> Cc: Cody P Schafer <> Cc: He Kuang <> Cc: Jeremie Galarneau <> Cc: Jiri Olsa <> Cc: Kirill Smelkov <> Cc: Li Zefan <> Cc: Masami Hiramatsu <> Cc: Namhyung Kim <> Cc: Peter Zijlstra <> Cc: Zefan Li <> Cc: Link: Signed-off-by: Arnaldo Carvalho de Melo <>
Diffstat (limited to 'tools/perf/builtin-stat.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 86289dfcb452..8c0bc0fe5179 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -1831,6 +1831,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
if (evsel_list == NULL)
return -ENOMEM;
+ parse_events__shrink_config_terms();
argc = parse_options_subcommand(argc, argv, stat_options, stat_subcommands,
(const char **) stat_usage,