aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/perf-trace.txt3
-rw-r--r--tools/perf/builtin-trace.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt
index 5a7035c5c523..115db9e06ecd 100644
--- a/tools/perf/Documentation/perf-trace.txt
+++ b/tools/perf/Documentation/perf-trace.txt
@@ -117,6 +117,9 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
117--sched:: 117--sched::
118 Accrue thread runtime and provide a summary at the end of the session. 118 Accrue thread runtime and provide a summary at the end of the session.
119 119
120--failure::
121 Show only syscalls that failed, i.e. that returned < 0.
122
120-i:: 123-i::
121--input:: 124--input::
122 Process events from a given perf data file. 125 Process events from a given perf data file.
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 87b95c9410b4..4e03f0f68241 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -112,6 +112,7 @@ struct trace {
112 bool multiple_threads; 112 bool multiple_threads;
113 bool summary; 113 bool summary;
114 bool summary_only; 114 bool summary_only;
115 bool failure_only;
115 bool show_comm; 116 bool show_comm;
116 bool print_sample; 117 bool print_sample;
117 bool show_tool_stats; 118 bool show_tool_stats;
@@ -1565,7 +1566,7 @@ static int trace__printf_interrupted_entry(struct trace *trace)
1565 struct thread_trace *ttrace; 1566 struct thread_trace *ttrace;
1566 size_t printed; 1567 size_t printed;
1567 1568
1568 if (trace->current == NULL) 1569 if (trace->failure_only || trace->current == NULL)
1569 return 0; 1570 return 0;
1570 1571
1571 ttrace = thread__priv(trace->current); 1572 ttrace = thread__priv(trace->current);
@@ -1638,7 +1639,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel,
1638 args, trace, thread); 1639 args, trace, thread);
1639 1640
1640 if (sc->is_exit) { 1641 if (sc->is_exit) {
1641 if (!(trace->duration_filter || trace->summary_only || trace->min_stack)) { 1642 if (!(trace->duration_filter || trace->summary_only || trace->failure_only || trace->min_stack)) {
1642 trace__fprintf_entry_head(trace, thread, 0, false, ttrace->entry_time, trace->output); 1643 trace__fprintf_entry_head(trace, thread, 0, false, ttrace->entry_time, trace->output);
1643 fprintf(trace->output, "%-70s)\n", ttrace->entry_str); 1644 fprintf(trace->output, "%-70s)\n", ttrace->entry_str);
1644 } 1645 }
@@ -1742,7 +1743,7 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
1742 } 1743 }
1743 } 1744 }
1744 1745
1745 if (trace->summary_only) 1746 if (trace->summary_only || (ret >= 0 && trace->failure_only))
1746 goto out; 1747 goto out;
1747 1748
1748 trace__fprintf_entry_head(trace, thread, duration, duration_calculated, ttrace->entry_time, trace->output); 1749 trace__fprintf_entry_head(trace, thread, duration, duration_calculated, ttrace->entry_time, trace->output);
@@ -3087,6 +3088,8 @@ int cmd_trace(int argc, const char **argv)
3087 OPT_INCR('v', "verbose", &verbose, "be more verbose"), 3088 OPT_INCR('v', "verbose", &verbose, "be more verbose"),
3088 OPT_BOOLEAN('T', "time", &trace.full_time, 3089 OPT_BOOLEAN('T', "time", &trace.full_time,
3089 "Show full timestamp, not time relative to first start"), 3090 "Show full timestamp, not time relative to first start"),
3091 OPT_BOOLEAN(0, "failure", &trace.failure_only,
3092 "Show only syscalls that failed"),
3090 OPT_BOOLEAN('s', "summary", &trace.summary_only, 3093 OPT_BOOLEAN('s', "summary", &trace.summary_only,
3091 "Show only syscall summary with statistics"), 3094 "Show only syscall summary with statistics"),
3092 OPT_BOOLEAN('S', "with-summary", &trace.summary, 3095 OPT_BOOLEAN('S', "with-summary", &trace.summary,