perf script: Print callchains and symbols if they exist - v2
PATCH 1/1 perf script: Print callchains and symbols if they exist - v2
The intent of perf-script is to dump the events and information in the file. H/W, S/W and raw events all dump callchains if they are present; might as well make that the default for tracepoints too.
v2: Only add options for sym, dso and ip if callchains are present
--- tools/perf/builtin-script.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
tools/perf/builtin-script.c +24 -0
@@ -280,6 +280,30 @@ static int perf_session__check_output_opt(struct perf_session *session)set_print_ip_opts (&evsel->attr); } +/* +* set default for tracepoints to print symbols only +* if callchains are present +*/ +if (symbol_conf.use_callchain && + !output[PERF_TYPE_TRACEPOINT ].user_set) { +struct perf_event_attr *attr; + + j =PERF_TYPE_TRACEPOINT ; + evsel =perf_session__find_first_evtype (session, j); +if (evsel ==NULL ) + goto out; + + attr = &evsel->attr; + +if (attr->sample_type &PERF_SAMPLE_CALLCHAIN ) { + output[j].fields |=PERF_OUTPUT_IP ; + output[j].fields |=PERF_OUTPUT_SYM ; + output[j].fields |=PERF_OUTPUT_DSO ; +set_print_ip_opts (attr); + } + } + +out:return 0 ; }
Signature · 1 line
1.8.3.4 (Apple Git-47)
Quoted 9 lines · David Ahern
The intent of perf-script is to dump the events and information in the file. H/W, S/W and raw events all dump callchains if they are present; might as well make that the default for tracepoints too.
v2: Only add options for sym, dso and ip if callchains are present
Signed-off-by David Ahern <[email protected]>Cc Frederic Weisbecker <[email protected]>
Thanks, looks good, just a few things:
Quoted 22 lines
--- tools/perf/builtin-script.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)tools/perf/builtin-script.c +10
-0@@ -280,6 +280,30 @@ static int perf_session__check_output_opt(struct perf_session *session)set_print_ip_opts (&evsel->attr); } +/* +* set default for tracepoints to print symbols only +* if callchains are present +*/ +if (symbol_conf.use_callchain && + !output[PERF_TYPE_TRACEPOINT ].user_set) { +struct perf_event_attr *attr; + + j =PERF_TYPE_TRACEPOINT ; + evsel =perf_session__find_first_evtype (session, j);
tools/perf/builtin-script.c static int perf_session__check_output_opt(struct perf_session *session) · line 302
Quoted 10 lines
tools/perf/builtin-script.c +10
-0+if (evsel ==NULL ) + goto out; + + attr = &evsel->attr; + +if (attr->sample_type &PERF_SAMPLE_CALLCHAIN ) { + output[j].fields |=PERF_OUTPUT_IP ; + output[j].fields |=PERF_OUTPUT_SYM ; + output[j].fields |=PERF_OUTPUT_DSO ; +set_print_ip_opts (attr);
We probably want to avoid DSO and IP for most tracepoints. For kernel tracepoints dso is going to be the kernel anyway and IP is often not that relevant either.
tracepoint already carries a lot of informations and it's better to avoid any noise.
Thanks.
Quoted 10 lines
tools/perf/builtin-script.c +4
-0+ } + } + +out:return 0 ; }Signature · 1 line
1.8.3.4 (Apple Git-47)
Quoted 3 lines · Frederic Weisbecker
We probably want to avoid DSO and IP for most tracepoints. For kernel tracepoints dso is going to be the kernel anyway and IP is often not that relevant either.
Sorry, you mentioned that last time and I forgot to respond.
Yes, there are a number of tracepoints that are completely kernel side and possibly uninteresting callstacks. There are others that are triggered in process context and you want to see the stacks all the way back to main. I would hope that users are adding -g to record only when it is truly wanted. Given that the idea of perf-script is to print data in a file why not dump everything in the file - address, dso, and symbol. There is always -G to suppress the callchains.
As an example it is useful to see the overhead of 'perf sched record -g': all I really want is callchains on sched_switch, and the callchains on sched_stat_runtime and wakeup are huge emphasizing the need to specify events where callchains are interesting and not collect them on others and that steps into the pandora's box of mixed sample types.
David
tip-bot for David Ahern
merge bot[tip:perf/core] perf script: Print callchains and symbols if they exist
In reply to David Ahernperf script: Print callchains and symbols if they exist
Commit-ID: 80b8b496ec6edaff01f9ab74dbe8a517cd718de8 Gitweb: http://git.kernel.org/tip/80b8b496ec6edaff01f9ab74dbe8a517cd718de8 Author: David Ahern <[email protected]> AuthorDate: Tue, 19 Nov 2013 21:07:37 -0700 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 27 Nov 2013 14:58:38 -0300
perf script: Print callchains and symbols if they exist
The intent of perf-script is to dump the events and information in the file. H/W, S/W and raw events all dump callchains if they are present; might as well make that the default for tracepoints too.
v2: Only add options for sym, dso and ip if callchains are present
--- tools/perf/builtin-script.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
tools/perf/builtin-script.c +24 -0
@@ -280,6 +280,30 @@ static int perf_session__check_output_opt(struct perf_session *session)set_print_ip_opts (&evsel->attr); } +/* +* set default for tracepoints to print symbols only +* if callchains are present +*/ +if (symbol_conf.use_callchain && + !output[PERF_TYPE_TRACEPOINT ].user_set) { +struct perf_event_attr *attr; + + j =PERF_TYPE_TRACEPOINT ; + evsel =perf_session__find_first_evtype (session, j); +if (evsel ==NULL ) + goto out; + + attr = &evsel->attr; + +if (attr->sample_type &PERF_SAMPLE_CALLCHAIN ) { + output[j].fields |=PERF_OUTPUT_IP ; + output[j].fields |=PERF_OUTPUT_SYM ; + output[j].fields |=PERF_OUTPUT_DSO ; +set_print_ip_opts (attr); + } + } + +out:return 0 ; }