From: Jiri Olsa <jolsa@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Jiri Olsa <jolsa@redhat.com>,
Corey Ashford <cjashfor@linux.vnet.ibm.com>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@elte.hu>, Namhyung Kim <namhyung@kernel.org>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Andi Kleen <ak@linux.intel.com>, David Ahern <dsahern@gmail.com>,
Stephane Eranian <eranian@google.com>
Subject: [PATCH 4/5] perf tools: Introduce new -P/--parent-deep report option
Date: Tue, 25 Jun 2013 13:54:12 +0200 [thread overview]
Message-ID: <1372161253-22081-5-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1372161253-22081-1-git-send-email-jolsa@redhat.com>
Introducing new -P/--parent-deep report option. It does the
same as '-p' but it force the deep search of the callchain
and looks for the deepest possible match.
The -p option searches for the first match of the parent
pattern in the callchain.
$ perf report -i perf.data.delete -p perf_session__delete -s parent
+ 99.51% [other]
+ 0.46% perf_session__delete_dead_threads
+ 0.03% perf_session__delete
+ 0.00% perf_session__delete_threads
so we got multiple 'different' matches instancies, while
they all belong under perf_session__delete function:
$ perf report -i perf.data.delete -P perf_session__delete -s parent
+ 99.51% [other]
+ 0.49% perf_session__delete
NOTE the 'p' vs 'P' difference in above commands above.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Stephane Eranian <eranian@google.com>
---
tools/perf/Documentation/perf-report.txt | 5 +++++
tools/perf/builtin-report.c | 12 ++++++++++++
tools/perf/util/machine.c | 4 +++-
tools/perf/util/symbol.h | 3 ++-
4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 66dab74..90d1566 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -96,6 +96,11 @@ OPTIONS
information recorded. The pattern is in the exteneded regex format and
defaults to "\^sys_|^do_page_fault", see '--sort parent'.
+-P::
+--parent-deep=<regex>::
+ Same as '-p' but it force the deep search of the callchain
+ and looks for the deepest possible match.
+
-x::
--exclude-other::
Only display entries with parent-match.
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 6ab49da..8c2c7ce 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -714,6 +714,16 @@ parse_percent_limit(const struct option *opt, const char *str,
return 0;
}
+static int
+parent_deep(const struct option *opt __maybe_unused,
+ const char *str,
+ int unset __maybe_unused)
+{
+ parent_pattern = str;
+ symbol_conf.parent_deep = true;
+ return 0;
+}
+
int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
{
struct perf_session *session;
@@ -777,6 +787,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
"Show sample percentage for different cpu modes"),
OPT_STRING('p', "parent", &parent_pattern, "regex",
"regex filter to identify parent, see: '--sort parent'"),
+ OPT_CALLBACK('P', "parent-deep", NULL, "regex",
+ "Enables deep callchain search, implies -p", parent_deep),
OPT_BOOLEAN('x', "exclude-other", &symbol_conf.exclude_other,
"Only display entries with parent-match"),
OPT_CALLBACK_DEFAULT('g', "call-graph", &report, "output_type,min_percent[,print_limit],call_order",
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 93527af..5ec5580 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1210,7 +1210,9 @@ static int machine__resolve_callchain_sample(struct machine *machine,
thread__find_addr_location(thread, machine, cpumode,
MAP__FUNCTION, ip, &al, NULL);
if (al.sym != NULL) {
- if (sort__has_parent && !*parent &&
+ bool more = symbol_conf.parent_deep || !*parent;
+
+ if (sort__has_parent && more &&
symbol__match_parent_regex(al.sym))
*parent = al.sym;
if (!symbol_conf.use_callchain)
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 5f720dc..6023edb 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -98,7 +98,8 @@ struct symbol_conf {
annotate_asm_raw,
annotate_src,
event_group,
- demangle;
+ demangle,
+ parent_deep;
const char *vmlinux_name,
*kallsyms_name,
*source_prefix,
--
1.7.11.7
next prev parent reply other threads:[~2013-06-25 11:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-25 11:54 [PATCH 0/5] perf tools: Parent option related fixies for report Jiri Olsa
2013-06-25 11:54 ` [PATCH 1/5] perf tools: Remove callchain_cursor_reset call Jiri Olsa
2013-06-25 17:00 ` David Ahern
2013-06-25 11:54 ` [PATCH 2/5] perf tools: Fix -x/--exclude-other option for report command Jiri Olsa
2013-06-25 17:02 ` David Ahern
2013-06-25 11:54 ` [PATCH 3/5] perf tools: Do not elide parent symbol column Jiri Olsa
2013-06-25 11:54 ` Jiri Olsa [this message]
2013-06-25 15:18 ` [PATCH 4/5] perf tools: Introduce new -P/--parent-deep report option Andi Kleen
2013-06-25 15:34 ` Jiri Olsa
2013-06-26 2:53 ` Namhyung Kim
2013-06-25 11:54 ` [PATCH 5/5] perf tools: Fix perf_session__delete removal for report command Jiri Olsa
2013-06-25 17:07 ` David Ahern
2013-07-19 7:44 ` [tip:perf/core] perf report: Fix perf_session__delete removal tip-bot for Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372161253-22081-5-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=cjashfor@linux.vnet.ibm.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=namhyung@kernel.org \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).