linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Stephane Eranian <eranian@google.com>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 22/34] perf symbols: Move idle syms check from top to generic function
Date: Wed, 27 Nov 2013 17:16:22 -0300	[thread overview]
Message-ID: <1385583394-3703-23-git-send-email-acme@infradead.org> (raw)
In-Reply-To: <1385583394-3703-1-git-send-email-acme@infradead.org>

From: David Ahern <dsahern@gmail.com>

Allows list of idle symbols to be leveraged by other commands, such as
the upcoming timehist command.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1384806771-2945-3-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c | 25 ++-----------------------
 tools/perf/util/symbol.c | 30 ++++++++++++++++++++++++++++++
 tools/perf/util/symbol.h |  1 +
 3 files changed, 33 insertions(+), 23 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 531522d3d97b..03d37a76c612 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -634,26 +634,9 @@ repeat:
 	return NULL;
 }
 
-/* Tag samples to be skipped. */
-static const char *skip_symbols[] = {
-	"intel_idle",
-	"default_idle",
-	"native_safe_halt",
-	"cpu_idle",
-	"enter_idle",
-	"exit_idle",
-	"mwait_idle",
-	"mwait_idle_with_hints",
-	"poll_idle",
-	"ppc64_runlatch_off",
-	"pseries_dedicated_idle_sleep",
-	NULL
-};
-
 static int symbol_filter(struct map *map __maybe_unused, struct symbol *sym)
 {
 	const char *name = sym->name;
-	int i;
 
 	/*
 	 * ppc64 uses function descriptors and appends a '.' to the
@@ -671,12 +654,8 @@ static int symbol_filter(struct map *map __maybe_unused, struct symbol *sym)
 	    strstr(name, "_text_end"))
 		return 1;
 
-	for (i = 0; skip_symbols[i]; i++) {
-		if (!strcmp(skip_symbols[i], name)) {
-			sym->ignore = true;
-			break;
-		}
-	}
+	if (symbol__is_idle(sym))
+		sym->ignore = true;
 
 	return 0;
 }
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index c0c36965fff0..f55c18da1e40 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -573,6 +573,36 @@ static u8 kallsyms2elf_type(char type)
 	return isupper(type) ? STB_GLOBAL : STB_LOCAL;
 }
 
+bool symbol__is_idle(struct symbol *sym)
+{
+	const char * const idle_symbols[] = {
+		"cpu_idle",
+		"intel_idle",
+		"default_idle",
+		"native_safe_halt",
+		"enter_idle",
+		"exit_idle",
+		"mwait_idle",
+		"mwait_idle_with_hints",
+		"poll_idle",
+		"ppc64_runlatch_off",
+		"pseries_dedicated_idle_sleep",
+		NULL
+	};
+
+	int i;
+
+	if (!sym)
+		return false;
+
+	for (i = 0; idle_symbols[i]; i++) {
+		if (!strcmp(idle_symbols[i], sym->name))
+			return true;
+	}
+
+	return false;
+}
+
 static int map__process_kallsym_symbol(void *arg, const char *name,
 				       char type, u64 start)
 {
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 07de8fea2f48..ad13c5d50b91 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -240,6 +240,7 @@ size_t symbol__fprintf(struct symbol *sym, FILE *fp);
 bool symbol_type__is_a(char symbol_type, enum map_type map_type);
 bool symbol__restricted_filename(const char *filename,
 				 const char *restricted_filename);
+bool symbol__is_idle(struct symbol *sym);
 
 int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
 		  struct symsrc *runtime_ss, symbol_filter_t filter,
-- 
1.8.1.4


  parent reply	other threads:[~2013-11-27 20:21 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 20:16 [PATCH 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 01/34] tools lib traceevent: Use helper trace-seq in print functions like kernel does Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 02/34] perf trace: Remove thread summary coloring Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 03/34] perf top: Make -g refer to callchains Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 04/34] perf completion: Introduce a layer of indirection Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 05/34] perf completion: Factor out compgen stuff Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 06/34] perf completion: Factor out call to __ltrim_colon_completions Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 07/34] perf completion: Introduce zsh support Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 08/34] perf completion: Rename file to reflect " Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 09/34] perf script: Move evname print code to process_event() Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 10/34] perf record: Make per-cpu mmaps the default Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 11/34] perf tools: Allow '--inherit' as the negation of '--no-inherit' Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 12/34] perf tools: Add option macro OPT_BOOLEAN_SET Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 13/34] perf record: Default -t option to no inheritance Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 14/34] perf timechart: Always try to print at least 15 tasks Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 15/34] perf timechart: Add option to limit number of tasks Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 16/34] perf timechart: Use proc_num to implement --power-only Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 17/34] perf timechart: Add support for displaying only tasks related data Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 18/34] perf timechart: Group figures and add title with details Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 19/34] perf timechart: Add support for -P and -T in timechart recording Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 20/34] perf timechart: Add backtrace support Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 21/34] perf evsel: Skip ignored symbols while printing callchain Arnaldo Carvalho de Melo
2013-11-27 20:16 ` Arnaldo Carvalho de Melo [this message]
2013-11-27 20:16 ` [PATCH 23/34] perf thread: Move comm_list check into function Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 24/34] perf tools: Export setup_list Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 25/34] perf script: Print callchains and symbols if they exist Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 26/34] perf script: Print comm, fork and exit events also Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 27/34] perf script: Print mmap[2] " Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 28/34] perf symbols: Fix not finding kcore in buildid cache Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 29/34] perf timechart: dynamically determine event fields offset Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 30/34] perf timechart: Remove some needless struct forward declarations Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 31/34] perf timechart: Remove misplaced __maybe_unused Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 32/34] perf tools: Fix tags/TAGS targets rebuilding Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 33/34] perf tools: Add per-feature check flags Arnaldo Carvalho de Melo
2013-11-27 20:16 ` [PATCH 34/34] perf tools unwinding: Use the " Arnaldo Carvalho de Melo
2013-11-27 22:43   ` Jiri Olsa
2013-11-28  9:58     ` Jiri Olsa
2013-11-28 12:56       ` Arnaldo Carvalho de Melo
2013-11-28 13:46         ` Arnaldo Carvalho de Melo
2013-11-28 20:02           ` Jean Pihet
2013-11-29 15:45             ` Jiri Olsa
2013-12-03 16:15               ` Jean Pihet
2013-12-07 10:17                 ` Jean Pihet

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=1385583394-3703-23-git-send-email-acme@infradead.org \
    --to=acme@infradead.org \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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).