[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200515224139.GB3577540@krava>
Date: Sat, 16 May 2020 00:41:39 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Kajol Jain <kjain@...ux.ibm.com>,
Andi Kleen <ak@...ux.intel.com>,
John Garry <john.garry@...wei.com>,
Jin Yao <yao.jin@...ux.intel.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Kim Phillips <kim.phillips@....com>,
Adrian Hunter <adrian.hunter@...el.com>,
Leo Yan <leo.yan@...aro.org>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, bpf@...r.kernel.org,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH v2 7/7] perf expr: Migrate expr ids table to a hashmap
On Fri, May 15, 2020 at 09:50:07AM -0700, Ian Rogers wrote:
SNIP
> diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c
> index 8b4ce704a68d..f64ab91c432b 100644
> --- a/tools/perf/util/expr.c
> +++ b/tools/perf/util/expr.c
> @@ -4,25 +4,76 @@
> #include "expr.h"
> #include "expr-bison.h"
> #include "expr-flex.h"
> +#include <linux/kernel.h>
>
> #ifdef PARSER_DEBUG
> extern int expr_debug;
> #endif
>
> +static size_t key_hash(const void *key, void *ctx __maybe_unused)
> +{
> + const char *str = (const char *)key;
> + size_t hash = 0;
> +
> + while (*str != '\0') {
> + hash *= 31;
> + hash += *str;
> + str++;
> + }
> + return hash;
> +}
> +
> +static bool key_equal(const void *key1, const void *key2,
> + void *ctx __maybe_unused)
> +{
> + return !strcmp((const char *)key1, (const char *)key2);
should that be strcasecmp ? would it affect the key_hash as well?
jirka
Powered by blists - more mailing lists