commit b8abd0f49d680c9f943ac460a5eba291424bb6d0 Author: Michael Petlan Date: Tue Dec 12 03:43:11 2017 +0100 perf trace: support multiple -e arguments Other perf subcommands, such as perf-stat allow multiple event specification arguments, like "perf stat -e evt1 -e evt2 ...". This patch enables perf-trace to allow that too. Before: 0.030 ( 0.004 ms): true/19173 close(fd: 3) = 0 0.089 ( 0.007 ms): true/19173 close(fd: 3) = 0 After: 0.018 ( 0.013 ms): true/19175 open(filename: /etc/ld.so.cache, flags: CLOEXEC) = 3 0.040 ( 0.004 ms): true/19175 close(fd: 3) = 0 0.053 ( 0.014 ms): true/19175 open(filename: /lib64/libc.so.6, flags: CLOEXEC) = 3 0.107 ( 0.006 ms): true/19175 close(fd: 3) = 0 Signed-off-by: Michael Petlan diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 7c57898..abcfdcc 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c @@ -2935,10 +2935,18 @@ static int trace__parse_events_option(const struct option *opt, const char *str, .dirname = strace_groups_dir, }; - trace->ev_qualifier = strlist__new(lists[1], &slist_config); if (trace->ev_qualifier == NULL) { - fputs("Not enough memory to parse event qualifier", trace->output); - goto out; + trace->ev_qualifier = strlist__new(lists[1], &slist_config); + if (trace->ev_qualifier == NULL) { + fputs("Not enough memory to parse event qualifier", trace->output); + goto out; + } + } else { + int rv = strlist__add(trace->ev_qualifier, lists[1]); + if (rv != 0) { + fputs("A problem occurred when parsing event qualifier", trace->output); + goto out; + } } if (trace__validate_ev_qualifier(trace))