* [PATCH] perf script: Print callchains and symbols if they exist - v2
@ 2013-11-20 4:07 David Ahern
2013-11-20 13:04 ` Frederic Weisbecker
2013-11-30 12:52 ` [tip:perf/core] perf script: Print callchains and symbols if they exist tip-bot for David Ahern
0 siblings, 2 replies; 4+ messages in thread
From: David Ahern @ 2013-11-20 4:07 UTC (permalink / raw)
To: acme, linux-kernel; +Cc: David Ahern, Frederic Weisbecker
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 <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
---
tools/perf/builtin-script.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index b392770766dd..9f3ba4404a14 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -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;
}
--
1.8.3.4 (Apple Git-47)
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] perf script: Print callchains and symbols if they exist - v2
2013-11-20 4:07 [PATCH] perf script: Print callchains and symbols if they exist - v2 David Ahern
@ 2013-11-20 13:04 ` Frederic Weisbecker
2013-11-20 14:09 ` David Ahern
2013-11-30 12:52 ` [tip:perf/core] perf script: Print callchains and symbols if they exist tip-bot for David Ahern
1 sibling, 1 reply; 4+ messages in thread
From: Frederic Weisbecker @ 2013-11-20 13:04 UTC (permalink / raw)
To: David Ahern; +Cc: acme, linux-kernel
On Tue, Nov 19, 2013 at 09:07:37PM -0700, David Ahern wrote:
> 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 <dsahern@gmail.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
Thanks, looks good, just a few things:
> ---
> tools/perf/builtin-script.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index b392770766dd..9f3ba4404a14 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -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);
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.
> + }
> + }
> +
> +out:
> return 0;
> }
>
> --
> 1.8.3.4 (Apple Git-47)
>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] perf script: Print callchains and symbols if they exist - v2
2013-11-20 13:04 ` Frederic Weisbecker
@ 2013-11-20 14:09 ` David Ahern
0 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2013-11-20 14:09 UTC (permalink / raw)
To: Frederic Weisbecker; +Cc: acme, linux-kernel
On 11/20/13, 6:04 AM, Frederic Weisbecker wrote:
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/core] perf script: Print callchains and symbols if they exist
2013-11-20 4:07 [PATCH] perf script: Print callchains and symbols if they exist - v2 David Ahern
2013-11-20 13:04 ` Frederic Weisbecker
@ 2013-11-30 12:52 ` tip-bot for David Ahern
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for David Ahern @ 2013-11-30 12:52 UTC (permalink / raw)
To: linux-tip-commits; +Cc: acme, linux-kernel, hpa, mingo, fweisbec, dsahern, tglx
Commit-ID: 80b8b496ec6edaff01f9ab74dbe8a517cd718de8
Gitweb: http://git.kernel.org/tip/80b8b496ec6edaff01f9ab74dbe8a517cd718de8
Author: David Ahern <dsahern@gmail.com>
AuthorDate: Tue, 19 Nov 2013 21:07:37 -0700
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
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
Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/1384920457-5986-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-script.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index b392770..9f3ba44 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-30 12:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-20 4:07 [PATCH] perf script: Print callchains and symbols if they exist - v2 David Ahern
2013-11-20 13:04 ` Frederic Weisbecker
2013-11-20 14:09 ` David Ahern
2013-11-30 12:52 ` [tip:perf/core] perf script: Print callchains and symbols if they exist tip-bot for David Ahern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox