aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/perf-trace.txt2
-rw-r--r--tools/perf/builtin-trace.c28
2 files changed, 21 insertions, 9 deletions
diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt
index cb3371eb597d..4754f11a862b 100644
--- a/tools/perf/Documentation/perf-trace.txt
+++ b/tools/perf/Documentation/perf-trace.txt
@@ -30,6 +30,8 @@ OPTIONS
30-e:: 30-e::
31--expr:: 31--expr::
32 List of events to show, currently only syscall names. 32 List of events to show, currently only syscall names.
33 Prefixing with ! shows all syscalls but the ones specified. You may
34 need to escape it.
33 35
34-o:: 36-o::
35--output=:: 37--output=::
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 9891d8cdb73d..6ab7a7a5e66e 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -114,8 +114,9 @@ struct trace {
114 struct machine host; 114 struct machine host;
115 u64 base_time; 115 u64 base_time;
116 FILE *output; 116 FILE *output;
117 struct strlist *ev_qualifier;
118 unsigned long nr_events; 117 unsigned long nr_events;
118 struct strlist *ev_qualifier;
119 bool not_ev_qualifier;
119 bool sched; 120 bool sched;
120 bool multiple_threads; 121 bool multiple_threads;
121 double duration_filter; 122 double duration_filter;
@@ -234,13 +235,17 @@ static int trace__read_syscall_info(struct trace *trace, int id)
234 sc = trace->syscalls.table + id; 235 sc = trace->syscalls.table + id;
235 sc->name = name; 236 sc->name = name;
236 237
237 if (trace->ev_qualifier && !strlist__find(trace->ev_qualifier, name)) { 238 if (trace->ev_qualifier) {
238 sc->filtered = true; 239 bool in = strlist__find(trace->ev_qualifier, name) != NULL;
239 /* 240
240 * No need to do read tracepoint information since this will be 241 if (!(in ^ trace->not_ev_qualifier)) {
241 * filtered out. 242 sc->filtered = true;
242 */ 243 /*
243 return 0; 244 * No need to do read tracepoint information since this will be
245 * filtered out.
246 */
247 return 0;
248 }
244 } 249 }
245 250
246 sc->fmt = syscall_fmt__find(sc->name); 251 sc->fmt = syscall_fmt__find(sc->name);
@@ -725,7 +730,12 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
725 } 730 }
726 731
727 if (ev_qualifier_str != NULL) { 732 if (ev_qualifier_str != NULL) {
728 trace.ev_qualifier = strlist__new(true, ev_qualifier_str); 733 const char *s = ev_qualifier_str;
734
735 trace.not_ev_qualifier = *s == '!';
736 if (trace.not_ev_qualifier)
737 ++s;
738 trace.ev_qualifier = strlist__new(true, s);
729 if (trace.ev_qualifier == NULL) { 739 if (trace.ev_qualifier == NULL) {
730 fputs("Not enough memory to parse event qualifier", 740 fputs("Not enough memory to parse event qualifier",
731 trace.output); 741 trace.output);