diff options
author | Kim Phillips <[email protected]> | 2020-02-10 10:31:47 -0600 |
---|---|---|
committer | Arnaldo Carvalho de Melo <[email protected]> | 2020-02-10 16:30:51 -0300 |
commit | bc5f15be2c814ca1ff6bb4e62d5b275a8c88cbb1 (patch) | |
tree | 4b50b8da40dc12f6cef5c1e5d9d8cc67dd8be5ae | |
parent | 0e71459afcbbf69e92a65085c45515d3f3f02c31 (diff) |
perf symbols: Convert symbol__is_idle() to use strlist
Use the more optimized strlist implementation to do the idle function
lookup.
Signed-off-by: Kim Phillips <[email protected]>
Acked-by: Song Liu <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Cong Wang <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Cc: Jin Yao <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Kan Liang <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lore.kernel.org/lkml/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r-- | tools/perf/util/symbol.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index f3120c4f47ad..1077013d8ce2 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -654,13 +654,17 @@ static bool symbol__is_idle(const char *name) NULL }; int i; + static struct strlist *idle_symbols_list; - for (i = 0; idle_symbols[i]; i++) { - if (!strcmp(idle_symbols[i], name)) - return true; - } + if (idle_symbols_list) + return strlist__has_entry(idle_symbols_list, name); - return false; + idle_symbols_list = strlist__new(NULL, NULL); + + for (i = 0; idle_symbols[i]; i++) + strlist__add(idle_symbols_list, idle_symbols[i]); + + return strlist__has_entry(idle_symbols_list, name); } static int map__process_kallsym_symbol(void *arg, const char *name, |