diff options
author | David Ahern <dsahern@gmail.com> | 2013-11-18 13:32:45 -0700 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-11-27 14:58:37 -0300 |
commit | 82d1deb0546a4af7a2ddbcfed99690b3a61776c5 (patch) | |
tree | e681eedec436d66b72d6af89a9b880e94dea52ea /tools/perf/util/symbol.c | |
parent | d2ff1b1499c8e0ad2fc79376a4215ba37771823f (diff) | |
download | linux-82d1deb0546a4af7a2ddbcfed99690b3a61776c5.tar.gz linux-82d1deb0546a4af7a2ddbcfed99690b3a61776c5.tar.bz2 linux-82d1deb0546a4af7a2ddbcfed99690b3a61776c5.zip |
perf symbols: Move idle syms check from top to generic function
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>
Diffstat (limited to 'tools/perf/util/symbol.c')
-rw-r--r-- | tools/perf/util/symbol.c | 30 |
1 files changed, 30 insertions, 0 deletions
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) { |