aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2013-11-12 11:31:15 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-11-12 14:24:38 -0500
commitfd2eabaf16984bc75695e43f4b76e6f20ed4ea41 (patch)
tree183ed62dbfd9b53d70c05aeecff230f6119d34bc /tools
parent99ff7150547382ee612c40d8d6a0670ddec7c9fc (diff)
perf trace: Add summary only option
Per request from Pekka make --summary a summary only option meaning do not show the individual system calls. Add another option to see all syscalls along with the summary. In addition use 's' and 'S' as shortcuts for the options. Requested-by: Pekka Enberg <penberg@kernel.org> Signed-off-by: David Ahern <dsahern@gmail.com> Tested-by: Pekka Enberg <penberg@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Pekka Enberg <penberg@kernel.org> Link: http://lkml.kernel.org/r/1384273875-3751-1-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/Documentation/perf-trace.txt10
-rw-r--r--tools/perf/builtin-trace.c16
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) {