#include "util/machine.h"
#include "util/thread.h"
#include "util/parse-options.h"
+#include "util/strlist.h"
#include "util/thread_map.h"
#include <libaudit.h>
struct syscall {
struct event_format *tp_format;
const char *name;
+ bool filtered;
struct syscall_fmt *fmt;
};
struct perf_record_opts opts;
struct machine host;
u64 base_time;
+ struct strlist *ev_qualifier;
unsigned long nr_events;
bool sched;
bool multiple_threads;
sc = trace->syscalls.table + id;
sc->name = name;
+
+ if (trace->ev_qualifier && !strlist__find(trace->ev_qualifier, name)) {
+ sc->filtered = true;
+ /*
+ * No need to do read tracepoint information since this will be
+ * filtered out.
+ */
+ return 0;
+ }
+
sc->fmt = syscall_fmt__find(sc->name);
snprintf(tp_name, sizeof(tp_name), "sys_enter_%s", sc->name);
char *msg;
void *args;
size_t printed = 0;
- struct thread *thread = machine__findnew_thread(&trace->host, sample->tid);
+ struct thread *thread;
struct syscall *sc = trace__syscall_info(trace, evsel, sample);
- struct thread_trace *ttrace = thread__trace(thread);
+ struct thread_trace *ttrace;
+
+ if (sc == NULL)
+ return -1;
- if (ttrace == NULL || sc == NULL)
+ if (sc->filtered)
+ return 0;
+
+ thread = machine__findnew_thread(&trace->host, sample->tid);
+ ttrace = thread__trace(thread);
+ if (ttrace == NULL)
return -1;
args = perf_evsel__rawptr(evsel, sample, "args");
{
int ret;
u64 duration = 0;
- struct thread *thread = machine__findnew_thread(&trace->host, sample->tid);
- struct thread_trace *ttrace = thread__trace(thread);
+ struct thread *thread;
struct syscall *sc = trace__syscall_info(trace, evsel, sample);
+ struct thread_trace *ttrace;
+
+ if (sc == NULL)
+ return -1;
- if (ttrace == NULL || sc == NULL)
+ if (sc->filtered)
+ return 0;
+
+ thread = machine__findnew_thread(&trace->host, sample->tid);
+ ttrace = thread__trace(thread);
+ if (ttrace == NULL)
return -1;
ret = perf_evsel__intval(evsel, sample, "ret");
.mmap_pages = 1024,
},
};
+ const char *ev_qualifier_str = NULL;
const struct option trace_options[] = {
+ OPT_STRING('e', "expr", &ev_qualifier_str, "expr",
+ "list of events to trace"),
OPT_STRING('p', "pid", &trace.opts.target.pid, "pid",
"trace events on existing process id"),
OPT_STRING(0, "tid", &trace.opts.target.tid, "tid",
argc = parse_options(argc, argv, trace_options, trace_usage, 0);
+ if (ev_qualifier_str != NULL) {
+ trace.ev_qualifier = strlist__new(true, ev_qualifier_str);
+ if (trace.ev_qualifier == NULL) {
+ puts("Not enough memory to parse event qualifier");
+ return -ENOMEM;
+ }
+ }
+
err = perf_target__validate(&trace.opts.target);
if (err) {
perf_target__strerror(&trace.opts.target, err, bf, sizeof(bf));