[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F6B8692-B1FE-4108-A6B3-44EEE5F92C97@fb.com>
Date: Mon, 10 Feb 2020 18:51:53 +0000
From: Song Liu <songliubraving@...com>
To: Kim Phillips <kim.phillips@....com>
CC: Arnaldo Carvalho de Melo <acme@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Andi Kleen <ak@...ux.intel.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Cong Wang <xiyou.wangcong@...il.com>,
Jin Yao <yao.jin@...ux.intel.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Davidlohr Bueso <dave@...olabs.net>,
"linux-perf-users@...r.kernel.org" <linux-perf-users@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3 v2] perf symbols: convert symbol__is_idle to use
strlist
> On Feb 10, 2020, at 8:31 AM, Kim Phillips <kim.phillips@....com> wrote:
>
> Use the more optimized strlist implementation to do the idle function
> lookup.
>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Andi Kleen <ak@...ux.intel.com>
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Cc: Mark Rutland <mark.rutland@....com>
> Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
> Cc: Jiri Olsa <jolsa@...nel.org>
> Cc: Jiri Olsa <jolsa@...hat.com>
> Cc: Namhyung Kim <namhyung@...nel.org>
> Cc: Cong Wang <xiyou.wangcong@...il.com>
> Cc: Jin Yao <yao.jin@...ux.intel.com>
> Cc: Kan Liang <kan.liang@...ux.intel.com>
> Cc: Kim Phillips <kim.phillips@....com>
> Cc: Song Liu <songliubraving@...com>
> Cc: Davidlohr Bueso <dave@...olabs.net>
> Cc: linux-perf-users@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Kim Phillips <kim.phillips@....com>
> ---
> v2: new this series, based on Jiri's comment:
>
> https://lore.kernel.org/lkml/20200120092844.GC608405@krava/
>
> ...and this time with the Cc list intact.
>
> 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 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;
nit, probably just personal preference:
Maybe move idle_symbols_list out of the function and add the logic
to symbol__init()?
Other than this:
Acked-by: Song Liu <songliubraving@...com>
>
> - 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,
> --
> 2.25.0
>
Powered by blists - more mailing lists