diff options
-rw-r--r-- | tools/perf/Documentation/perf-trace.txt | 10 | ||||
-rw-r--r-- | tools/perf/builtin-trace.c | 16 |
2 files changed, 21 insertions, 5 deletions
diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt index 7b0497f95a75..fae38d9a44a4 100644 --- a/tools/perf/Documentation/perf-trace.txt +++ b/tools/perf/Documentation/perf-trace.txt | |||
@@ -93,9 +93,15 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs. | |||
93 | --comm:: | 93 | --comm:: |
94 | Show process COMM right beside its ID, on by default, disable with --no-comm. | 94 | Show process COMM right beside its ID, on by default, disable with --no-comm. |
95 | 95 | ||
96 | -s:: | ||
96 | --summary:: | 97 | --summary:: |
97 | Show a summary of syscalls by thread with min, max, and average times (in | 98 | Show only a summary of syscalls by thread with min, max, and average times |
98 | msec) and relative stddev. | 99 | (in msec) and relative stddev. |
100 | |||
101 | -S:: | ||
102 | --with-summary:: | ||
103 | Show all syscalls followed by a summary by thread with min, max, and | ||
104 | average times (in msec) and relative stddev. | ||
99 | 105 | ||
100 | --tool_stats:: | 106 | --tool_stats:: |
101 | Show tool stats such as number of times fd->pathname was discovered thru | 107 | Show tool stats such as number of times fd->pathname was discovered thru |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 0964c0cdc982..aa5702ffa2cb 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -1168,6 +1168,7 @@ struct trace { | |||
1168 | bool sched; | 1168 | bool sched; |
1169 | bool multiple_threads; | 1169 | bool multiple_threads; |
1170 | bool summary; | 1170 | bool summary; |
1171 | bool summary_only; | ||
1171 | bool show_comm; | 1172 | bool show_comm; |
1172 | bool show_tool_stats; | 1173 | bool show_tool_stats; |
1173 | double duration_filter; | 1174 | double duration_filter; |
@@ -1611,7 +1612,7 @@ static int trace__sys_enter(struct trace *trace, struct perf_evsel *evsel, | |||
1611 | args, trace, thread); | 1612 | args, trace, thread); |
1612 | 1613 | ||
1613 | if (!strcmp(sc->name, "exit_group") || !strcmp(sc->name, "exit")) { | 1614 | if (!strcmp(sc->name, "exit_group") || !strcmp(sc->name, "exit")) { |
1614 | if (!trace->duration_filter) { | 1615 | if (!trace->duration_filter && !trace->summary_only) { |
1615 | trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output); | 1616 | trace__fprintf_entry_head(trace, thread, 1, sample->time, trace->output); |
1616 | fprintf(trace->output, "%-70s\n", ttrace->entry_str); | 1617 | fprintf(trace->output, "%-70s\n", ttrace->entry_str); |
1617 | } | 1618 | } |
@@ -1664,6 +1665,9 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel, | |||
1664 | } else if (trace->duration_filter) | 1665 | } else if (trace->duration_filter) |
1665 | goto out; | 1666 | goto out; |
1666 | 1667 | ||
1668 | if (trace->summary_only) | ||
1669 | goto out; | ||
1670 | |||
1667 | trace__fprintf_entry_head(trace, thread, duration, sample->time, trace->output); | 1671 | trace__fprintf_entry_head(trace, thread, duration, sample->time, trace->output); |
1668 | 1672 | ||
1669 | if (ttrace->entry_pending) { | 1673 | if (ttrace->entry_pending) { |
@@ -2282,8 +2286,10 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) | |||
2282 | OPT_INCR('v', "verbose", &verbose, "be more verbose"), | 2286 | OPT_INCR('v', "verbose", &verbose, "be more verbose"), |
2283 | OPT_BOOLEAN('T', "time", &trace.full_time, | 2287 | OPT_BOOLEAN('T', "time", &trace.full_time, |
2284 | "Show full timestamp, not time relative to first start"), | 2288 | "Show full timestamp, not time relative to first start"), |
2285 | OPT_BOOLEAN(0, "summary", &trace.summary, | 2289 | OPT_BOOLEAN('s', "summary", &trace.summary_only, |
2286 | "Show syscall summary with statistics"), | 2290 | "Show only syscall summary with statistics"), |
2291 | OPT_BOOLEAN('S', "with-summary", &trace.summary, | ||
2292 | "Show all syscalls and summary with statistics"), | ||
2287 | OPT_END() | 2293 | OPT_END() |
2288 | }; | 2294 | }; |
2289 | int err; | 2295 | int err; |
@@ -2294,6 +2300,10 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) | |||
2294 | 2300 | ||
2295 | argc = parse_options(argc, argv, trace_options, trace_usage, 0); | 2301 | argc = parse_options(argc, argv, trace_options, trace_usage, 0); |
2296 | 2302 | ||
2303 | /* summary_only implies summary option, but don't overwrite summary if set */ | ||
2304 | if (trace.summary_only) | ||
2305 | trace.summary = trace.summary_only; | ||
2306 | |||
2297 | if (output_name != NULL) { | 2307 | if (output_name != NULL) { |
2298 | err = trace__open_output(&trace, output_name); | 2308 | err = trace__open_output(&trace, output_name); |
2299 | if (err < 0) { | 2309 | if (err < 0) { |