linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Namhyung Kim <namhyung@kernel.org>,
	Andi Kleen <andi@firstfloor.org>, David Ahern <dsahern@gmail.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Stephane Eranian <eranian@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 06/12] perf callchain: Add option to skip ignore symbol when printing callchains
Date: Fri, 25 Nov 2016 12:12:21 -0300	[thread overview]
Message-ID: <1480086747-2393-7-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1480086747-2393-1-git-send-email-acme@kernel.org>

From: Namhyung Kim <namhyung@kernel.org>

For tracepoint events, callchains always contain certain functions.
Sometimes it'd be better to skip those functions as they have no value.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/20161124011114.7102-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-sched.c      | 3 ++-
 tools/perf/util/evsel.h         | 1 +
 tools/perf/util/evsel_fprintf.c | 7 ++++++-
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 829468defa07..43fcc13e402d 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1876,7 +1876,8 @@ static void timehist_print_sample(struct perf_sched *sched,
 
 	sample__fprintf_sym(sample, al, 0,
 			    EVSEL__PRINT_SYM | EVSEL__PRINT_ONELINE |
-			    EVSEL__PRINT_CALLCHAIN_ARROW,
+			    EVSEL__PRINT_CALLCHAIN_ARROW |
+			    EVSEL__PRINT_SKIP_IGNORED,
 			    &callchain_cursor, stdout);
 
 out:
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 27fa3a343577..6abb89cd27f9 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -392,6 +392,7 @@ int perf_evsel__fprintf(struct perf_evsel *evsel,
 #define EVSEL__PRINT_SRCLINE		(1<<5)
 #define EVSEL__PRINT_UNKNOWN_AS_ADDR	(1<<6)
 #define EVSEL__PRINT_CALLCHAIN_ARROW	(1<<7)
+#define EVSEL__PRINT_SKIP_IGNORED	(1<<8)
 
 struct callchain_cursor;
 
diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c
index 53bb614feafb..5a6f52284452 100644
--- a/tools/perf/util/evsel_fprintf.c
+++ b/tools/perf/util/evsel_fprintf.c
@@ -109,6 +109,7 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
 	int print_srcline = print_opts & EVSEL__PRINT_SRCLINE;
 	int print_unknown_as_addr = print_opts & EVSEL__PRINT_UNKNOWN_AS_ADDR;
 	int print_arrow = print_opts & EVSEL__PRINT_CALLCHAIN_ARROW;
+	int print_skip_ignored = print_opts & EVSEL__PRINT_SKIP_IGNORED;
 	char s = print_oneline ? ' ' : '\t';
 	bool first = true;
 
@@ -124,6 +125,9 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
 			if (!node)
 				break;
 
+			if (node->sym && node->sym->ignore && print_skip_ignored)
+				goto next;
+
 			printed += fprintf(fp, "%-*.*s", left_alignment, left_alignment, " ");
 
 			if (print_arrow && !first)
@@ -162,8 +166,9 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment,
 			if (!print_oneline)
 				printed += fprintf(fp, "\n");
 
-			callchain_cursor_advance(cursor);
 			first = false;
+next:
+			callchain_cursor_advance(cursor);
 		}
 	}
 
-- 
2.7.4

  parent reply	other threads:[~2016-11-25 15:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25 15:12 [GIT PULL 00/12] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-11-25 15:12 ` [PATCH 01/12] perf annotate: Remove duplicate 'name' field from disasm_line Arnaldo Carvalho de Melo
2016-11-25 15:12 ` [PATCH 02/12] perf annotate: Introduce alternative method of keeping instructions table Arnaldo Carvalho de Melo
2016-11-25 15:12 ` [PATCH 03/12] perf annotate: Allow arches to have a init routine and a priv area Arnaldo Carvalho de Melo
2016-11-25 15:12 ` [PATCH 04/12] perf annotate: Improve support for ARM Arnaldo Carvalho de Melo
2016-11-25 15:12 ` [PATCH 05/12] perf annotate: Initial PowerPC support Arnaldo Carvalho de Melo
2016-11-25 15:12 ` Arnaldo Carvalho de Melo [this message]
2016-11-25 15:12 ` [PATCH 07/12] perf sched timehist: Mark schedule function in callchains Arnaldo Carvalho de Melo
2016-11-25 15:12 ` [PATCH 08/12] perf sched timehist: Enlarge max stack depth by 2 Arnaldo Carvalho de Melo
2016-11-25 15:12 ` [PATCH 09/12] perf tools: Fix kernel version error in ubuntu Arnaldo Carvalho de Melo
2016-11-25 15:12 ` [PATCH 10/12] perf record: Fix segfault when running with suid and kptr_restrict is 1 Arnaldo Carvalho de Melo
2016-11-25 15:12 ` [PATCH 11/12] perf tools: Add missing struct definition in probe_event.h Arnaldo Carvalho de Melo
2016-11-25 15:12 ` [PATCH 12/12] tools lib bpf: Fix maps resolution Arnaldo Carvalho de Melo
2016-11-25 17:14 ` [GIT PULL 00/12] perf/core improvements and fixes Ingo Molnar

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=1480086747-2393-7-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.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).