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 | |
parent | d2ff1b1499c8e0ad2fc79376a4215ba37771823f (diff) | |
download | talos-obmc-linux-82d1deb0546a4af7a2ddbcfed99690b3a61776c5.tar.gz talos-obmc-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')
-rw-r--r-- | tools/perf/util/symbol.c | 30 | ||||
-rw-r--r-- | tools/perf/util/symbol.h | 1 |
2 files changed, 31 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) { 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, |