aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2013-11-18 15:32:45 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-11-27 12:58:37 -0500
commit82d1deb0546a4af7a2ddbcfed99690b3a61776c5 (patch)
treee681eedec436d66b72d6af89a9b880e94dea52ea /tools
parentd2ff1b1499c8e0ad2fc79376a4215ba37771823f (diff)
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')
-rw-r--r--tools/perf/builtin-top.c25
-rw-r--r--tools/perf/util/symbol.c30
-rw-r--r--tools/perf/util/symbol.h1
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:
634 return NULL; 634 return NULL;
635} 635}
636 636
637/* Tag samples to be skipped. */
638static const char *skip_symbols[] = {
639 "intel_idle",
640 "default_idle",
641 "native_safe_halt",
642 "cpu_idle",
643 "enter_idle",
644 "exit_idle",
645 "mwait_idle",
646 "mwait_idle_with_hints",
647 "poll_idle",
648 "ppc64_runlatch_off",
649 "pseries_dedicated_idle_sleep",
650 NULL
651};
652
653static int symbol_filter(struct map *map __maybe_unused, struct symbol *sym) 637static int symbol_filter(struct map *map __maybe_unused, struct symbol *sym)
654{ 638{
655 const char *name = sym->name; 639 const char *name = sym->name;
656 int i;
657 640
658 /* 641 /*
659 * ppc64 uses function descriptors and appends a '.' to the 642 * 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)
671 strstr(name, "_text_end")) 654 strstr(name, "_text_end"))
672 return 1; 655 return 1;
673 656
674 for (i = 0; skip_symbols[i]; i++) { 657 if (symbol__is_idle(sym))
675 if (!strcmp(skip_symbols[i], name)) { 658 sym->ignore = true;
676 sym->ignore = true;
677 break;
678 }
679 }
680 659
681 return 0; 660 return 0;
682} 661}
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)
573 return isupper(type) ? STB_GLOBAL : STB_LOCAL; 573 return isupper(type) ? STB_GLOBAL : STB_LOCAL;
574} 574}
575 575
576bool symbol__is_idle(struct symbol *sym)
577{
578 const char * const idle_symbols[] = {
579 "cpu_idle",
580 "intel_idle",
581 "default_idle",
582 "native_safe_halt",
583 "enter_idle",
584 "exit_idle",
585 "mwait_idle",
586 "mwait_idle_with_hints",
587 "poll_idle",
588 "ppc64_runlatch_off",
589 "pseries_dedicated_idle_sleep",
590 NULL
591 };
592
593 int i;
594
595 if (!sym)
596 return false;
597
598 for (i = 0; idle_symbols[i]; i++) {
599 if (!strcmp(idle_symbols[i], sym->name))
600 return true;
601 }
602
603 return false;
604}
605
576static int map__process_kallsym_symbol(void *arg, const char *name, 606static int map__process_kallsym_symbol(void *arg, const char *name,
577 char type, u64 start) 607 char type, u64 start)
578{ 608{
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);
240bool symbol_type__is_a(char symbol_type, enum map_type map_type); 240bool symbol_type__is_a(char symbol_type, enum map_type map_type);
241bool symbol__restricted_filename(const char *filename, 241bool symbol__restricted_filename(const char *filename,
242 const char *restricted_filename); 242 const char *restricted_filename);
243bool symbol__is_idle(struct symbol *sym);
243 244
244int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss, 245int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *syms_ss,
245 struct symsrc *runtime_ss, symbol_filter_t filter, 246 struct symsrc *runtime_ss, symbol_filter_t filter,