[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YUuY+WhB3Y3VQm2w@krava>
Date: Wed, 22 Sep 2021 22:58:33 +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>,
linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>,
Jin Yao <yao.jin@...ux.intel.com>,
John Garry <john.garry@...wei.com>,
Paul Clarke <pc@...ibm.com>, kajoljain <kjain@...ux.ibm.com>,
linux-perf-users@...r.kernel.org,
Stephane Eranian <eranian@...gle.com>,
Sandeep Dasgupta <sdasgup@...gle.com>
Subject: Re: [PATCH v8 5/8] perf metric: Add utilities to work on ids map.
SNIP
> diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c
> index adf16bb7571a..34b51ca5e87f 100644
> --- a/tools/perf/util/expr.c
> +++ b/tools/perf/util/expr.c
> @@ -59,8 +59,48 @@ static bool key_equal(const void *key1, const void *key2,
> return !strcmp((const char *)key1, (const char *)key2);
> }
>
> -/* Caller must make sure id is allocated */
> -int expr__add_id(struct expr_parse_ctx *ctx, const char *id)
> +struct hashmap *ids__new(void)
> +{
> + return hashmap__new(key_hash, key_equal, NULL);
> +}
> +
> +void ids__free(struct hashmap *ids)
> +{
> + struct hashmap_entry *cur;
> + size_t bkt;
> +
> + if (ids == NULL)
> + return;
> +
> +#ifdef PARSER_DEBUG
> + fprintf(stderr, "freeing ids: ");
> + ids__print(ids);
> + fprintf(stderr, "\n");
> +#endif
hum, is this intended or forgotten debug leftover?
jirka
> +
> + hashmap__for_each_entry(ids, cur, bkt) {
> + free((char *)cur->key);
> + free(cur->value);
> + }
> +
> + hashmap__free(ids);
> +}
> +
> +void ids__print(struct hashmap *ids)
SNIP
Powered by blists - more mailing lists