diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2016-02-18 20:11:06 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2016-02-18 20:11:06 -0500 |
commit | ee0c607e5582ae4768c0b0fe93fa207974f26a34 (patch) | |
tree | 45a23ad0c919b7ac1e03023d16457027aea3b776 | |
parent | 72e659581e20fef67bb22e9e2da03eeb1dbc76cd (diff) | |
download | trace-cmd-ee0c607e5582ae4768c0b0fe93fa207974f26a34.tar.gz |
trace-cmd-report: Add -I option to remove interrupts from trace
The -I option in trace-cmd report will not print events if the HARDIRQ flag
is set. It does not affect softirqs.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | Documentation/trace-cmd-report.1.txt | 7 | ||||
-rw-r--r-- | trace-read.c | 27 | ||||
-rw-r--r-- | trace-usage.c | 1 |
3 files changed, 30 insertions, 5 deletions
diff --git a/Documentation/trace-cmd-report.1.txt b/Documentation/trace-cmd-report.1.txt index 54bc70ea..e3737f77 100644 --- a/Documentation/trace-cmd-report.1.txt +++ b/Documentation/trace-cmd-report.1.txt @@ -131,6 +131,13 @@ OPTIONS -F '.*:COMM != "trace-cmd"' ------------------------------------------ +*-I*:: + Do not print events where the HARDIRQ latency flag is set. + This will filter out most events that are from interrupt context. + Note, it may not filter out function traced functions that are + in interrupt context but were called before the kernel "in interrupt" + flag was set. + *-v*:: This causes the following filters of *-F* to filter out the matching events. diff --git a/trace-read.c b/trace-read.c index e034a89c..cc0e9962 100644 --- a/trace-read.c +++ b/trace-read.c @@ -106,6 +106,8 @@ static int profile; static int buffer_breaks = 0; static int debug = 0; +static int no_irqs; + static struct format_field *wakeup_task; static struct format_field *wakeup_success; static struct format_field *wakeup_new_task; @@ -851,10 +853,18 @@ static void read_rest(void) } static int -test_filters(struct filter *event_filters, struct pevent_record *record, int neg) +test_filters(struct pevent *pevent, struct filter *event_filters, + struct pevent_record *record, int neg) { int found = 0; int ret = FILTER_NONE; + int flags; + + if (no_irqs) { + flags = pevent_data_flags(pevent, record); + if (flags & TRACE_FLAG_HARDIRQ) + return FILTER_MISS; + } while (event_filters) { ret = pevent_filter_match(event_filters->filter, record); @@ -950,7 +960,7 @@ test_stacktrace(struct handle_list *handles, struct pevent_record *record, * being filtered out. */ if (id == info->stacktrace_id) { - ret = test_filters(handles->event_filter_out, record, 1); + ret = test_filters(pevent, handles->event_filter_out, record, 1); if (ret != FILTER_MATCH) return cpu_info->last_printed; return 0; @@ -963,6 +973,7 @@ test_stacktrace(struct handle_list *handles, struct pevent_record *record, static struct pevent_record *get_next_record(struct handle_list *handles) { struct pevent_record *record; + struct pevent *pevent; int found = 0; int cpu; int ret; @@ -973,6 +984,8 @@ static struct pevent_record *get_next_record(struct handle_list *handles) if (handles->done) return NULL; + pevent = tracecmd_get_pevent(handles->handle); + do { if (filter_cpus) { long long last_stamp = -1; @@ -998,7 +1011,7 @@ static struct pevent_record *get_next_record(struct handle_list *handles) record = tracecmd_read_next_data(handles->handle, &cpu); if (record) { - ret = test_filters(handles->event_filters, record, 0); + ret = test_filters(pevent, handles->event_filters, record, 0); switch (ret) { case FILTER_NOEXIST: /* Stack traces may still filter this */ @@ -1011,7 +1024,8 @@ static struct pevent_record *get_next_record(struct handle_list *handles) case FILTER_NONE: case FILTER_MATCH: /* Test the negative filters (-v) */ - ret = test_filters(handles->event_filter_out, record, 1); + ret = test_filters(pevent, handles->event_filter_out, + record, 1); if (ret != FILTER_MATCH) { found = 1; break; @@ -1425,7 +1439,7 @@ void trace_report (int argc, char **argv) {NULL, 0, NULL, 0} }; - c = getopt_long (argc-1, argv+1, "+hi:H:feGpRr:tPNn:LlEwF:VvTqO:", + c = getopt_long (argc-1, argv+1, "+hIi:H:feGpRr:tPNn:LlEwF:VvTqO:", long_options, &option_index); if (c == -1) break; @@ -1454,6 +1468,9 @@ void trace_report (int argc, char **argv) case 'f': show_funcs = 1; break; + case 'I': + no_irqs = 1; + break; case 'P': show_printk = 1; break; diff --git a/trace-usage.c b/trace-usage.c index 5cdbf555..743e260f 100644 --- a/trace-usage.c +++ b/trace-usage.c @@ -139,6 +139,7 @@ static struct usage_help usage_help[] = { " -P show printk list\n" " -E show event files stored\n" " -F filter to filter output on\n" + " -I filter out events with the HARDIRQ flag set\n" " -t print out full timestamp. Do not truncate to 6 places.\n" " -R raw format: ignore print format and only show field data\n" " -r raw format the events that match the option\n" |