Allows user to specify a list of symbols not interested in. One use case is the upcoming timehist command.
Signed-off-by: David Ahern <dsah...@gmail.com> Cc: Ingo Molnar <mi...@kernel.org> Cc: Jiri Olsa <jo...@redhat.com> Cc: Namhyung Kim <namhy...@kernel.org> Cc: Frederic Weisbecker <fweis...@gmail.com> Cc: Peter Zijlstra <pet...@infradead.org> Cc: Stephane Eranian <eran...@google.com> --- tools/perf/util/symbol.c | 20 ++++++++++++++++++++ tools/perf/util/symbol.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 1f777f9..4c90a7a 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -549,6 +549,18 @@ bool symbol__is_idle(struct symbol *sym) return sym->is_idle; } +bool symbol__is_excluded(struct symbol *sym) +{ + if (sym == NULL) + return false; + + if (symbol_conf.excl_sym_list && + strlist__has_entry(symbol_conf.excl_sym_list, sym->name)) + return true; + + return false; +} + static int map__process_kallsym_symbol(void *arg, const char *name, char type, u64 start) { @@ -1518,6 +1530,10 @@ int symbol__init(void) symbol_conf.sym_list_str, "symbol") < 0) goto out_free_comm_list; + if (setup_list(&symbol_conf.excl_sym_list, + symbol_conf.excl_sym_list_str, "exclude symbol") < 0) + goto out_free_sym_list; + /* * A path to symbols of "/" is identical to "" * reset here for simplicity. @@ -1535,6 +1551,8 @@ int symbol__init(void) symbol_conf.initialized = true; return 0; +out_free_sym_list: + strlist__delete(symbol_conf.sym_list); out_free_comm_list: strlist__delete(symbol_conf.comm_list); out_free_dso_list: @@ -1546,10 +1564,12 @@ void symbol__exit(void) { if (!symbol_conf.initialized) return; + strlist__delete(symbol_conf.excl_sym_list); strlist__delete(symbol_conf.sym_list); strlist__delete(symbol_conf.dso_list); strlist__delete(symbol_conf.comm_list); vmlinux_path__exit(); + symbol_conf.excl_sym_list = NULL; symbol_conf.sym_list = symbol_conf.dso_list = symbol_conf.comm_list = NULL; symbol_conf.initialized = false; } diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index c163ba9..9501213 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@ -112,10 +112,12 @@ struct symbol_conf { const char *dso_list_str, *comm_list_str, *sym_list_str, + *excl_sym_list_str, *col_width_list_str; struct strlist *dso_list, *comm_list, *sym_list, + *excl_sym_list, *dso_from_list, *dso_to_list, *sym_from_list, @@ -239,6 +241,7 @@ 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); +bool symbol__is_excluded(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.7.10.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/