[tip: perf/urgent] perf symbols: Convert symbol__is_idle() to use strlist
From: tip-bot2 for Kim Phillips
Date: Sat Feb 15 2020 - 03:42:32 EST
The following commit has been merged into the perf/urgent branch of tip:
Commit-ID: bc5f15be2c814ca1ff6bb4e62d5b275a8c88cbb1
Gitweb: https://git.kernel.org/tip/bc5f15be2c814ca1ff6bb4e62d5b275a8c88cbb1
Author: Kim Phillips <kim.phillips@xxxxxxx>
AuthorDate: Mon, 10 Feb 2020 10:31:47 -06:00
Committer: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
CommitterDate: Mon, 10 Feb 2020 16:30:51 -03:00
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 <kim.phillips@xxxxxxx>
Acked-by: Song Liu <songliubraving@xxxxxx>
Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Cc: Cong Wang <xiyou.wangcong@xxxxxxxxx>
Cc: Davidlohr Bueso <dave@xxxxxxxxxxxx>
Cc: Jin Yao <yao.jin@xxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Link: http://lore.kernel.org/lkml/20200210163147.25358-1-kim.phillips@xxxxxxx
Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
---
tools/perf/util/symbol.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index f3120c4..1077013 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,