perf trace: Support ! in -e expressions
So that we can ask for all but a set of syscalls to be traced. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-9j6hvap23qanyl96wx4mrj9k@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -30,6 +30,8 @@ OPTIONS
|
|||||||
-e::
|
-e::
|
||||||
--expr::
|
--expr::
|
||||||
List of events to show, currently only syscall names.
|
List of events to show, currently only syscall names.
|
||||||
|
Prefixing with ! shows all syscalls but the ones specified. You may
|
||||||
|
need to escape it.
|
||||||
|
|
||||||
-o::
|
-o::
|
||||||
--output=::
|
--output=::
|
||||||
|
@@ -114,8 +114,9 @@ struct trace {
|
|||||||
struct machine host;
|
struct machine host;
|
||||||
u64 base_time;
|
u64 base_time;
|
||||||
FILE *output;
|
FILE *output;
|
||||||
struct strlist *ev_qualifier;
|
|
||||||
unsigned long nr_events;
|
unsigned long nr_events;
|
||||||
|
struct strlist *ev_qualifier;
|
||||||
|
bool not_ev_qualifier;
|
||||||
bool sched;
|
bool sched;
|
||||||
bool multiple_threads;
|
bool multiple_threads;
|
||||||
double duration_filter;
|
double duration_filter;
|
||||||
@@ -234,13 +235,17 @@ static int trace__read_syscall_info(struct trace *trace, int id)
|
|||||||
sc = trace->syscalls.table + id;
|
sc = trace->syscalls.table + id;
|
||||||
sc->name = name;
|
sc->name = name;
|
||||||
|
|
||||||
if (trace->ev_qualifier && !strlist__find(trace->ev_qualifier, name)) {
|
if (trace->ev_qualifier) {
|
||||||
sc->filtered = true;
|
bool in = strlist__find(trace->ev_qualifier, name) != NULL;
|
||||||
/*
|
|
||||||
* No need to do read tracepoint information since this will be
|
if (!(in ^ trace->not_ev_qualifier)) {
|
||||||
* filtered out.
|
sc->filtered = true;
|
||||||
*/
|
/*
|
||||||
return 0;
|
* No need to do read tracepoint information since this will be
|
||||||
|
* filtered out.
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sc->fmt = syscall_fmt__find(sc->name);
|
sc->fmt = syscall_fmt__find(sc->name);
|
||||||
@@ -725,7 +730,12 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ev_qualifier_str != NULL) {
|
if (ev_qualifier_str != NULL) {
|
||||||
trace.ev_qualifier = strlist__new(true, ev_qualifier_str);
|
const char *s = ev_qualifier_str;
|
||||||
|
|
||||||
|
trace.not_ev_qualifier = *s == '!';
|
||||||
|
if (trace.not_ev_qualifier)
|
||||||
|
++s;
|
||||||
|
trace.ev_qualifier = strlist__new(true, s);
|
||||||
if (trace.ev_qualifier == NULL) {
|
if (trace.ev_qualifier == NULL) {
|
||||||
fputs("Not enough memory to parse event qualifier",
|
fputs("Not enough memory to parse event qualifier",
|
||||||
trace.output);
|
trace.output);
|
||||||
|
Reference in New Issue
Block a user