[PATCH v1 18/26] perf s390: Use generic hashmap for counter name cache
From: Ian Rogers
Date: Fri Nov 13 2026 - 16:51:27 EST
Convert the counter name cache in util/s390-sample-raw.c to
DECLARE_HASHMAP(s390_counter_name_map, long, char *).
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/util/s390-sample-raw.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/s390-sample-raw.c b/tools/perf/util/s390-sample-raw.c
index e0fac2aa15ed..c9afc4bc4a39 100644
--- a/tools/perf/util/s390-sample-raw.c
+++ b/tools/perf/util/s390-sample-raw.c
@@ -170,6 +170,8 @@ static bool get_counter_name_hashmap_equal_fn(long key1, long key2, void *ctx __
return key1 == key2;
}
+DECLARE_HASHMAP(s390_counter_name_map, long, char *);
+
/* Scan the PMU and extract the logical name of a counter from the event. Input
* is the counter set and counter number with in the set. Construct the event
* number and use this as key. If they match return the name of this counter.
@@ -177,7 +179,7 @@ static bool get_counter_name_hashmap_equal_fn(long key1, long key2, void *ctx __
*/
static char *get_counter_name(int set, int nr, struct perf_pmu *pmu)
{
- static struct hashmap *cache;
+ static struct s390_counter_name_map *cache;
static struct perf_pmu *cache_pmu;
long cache_key = get_counterset_start(set) + nr;
struct get_counter_name_data data = {
@@ -198,7 +200,8 @@ static char *get_counter_name(int set, int nr, struct perf_pmu *pmu)
result = strdup(data.result ?: "<unknown>");
if (cache_pmu == NULL) {
- struct hashmap *tmp = hashmap__new(get_counter_name_hash_fn,
+ struct s390_counter_name_map *tmp =
+ s390_counter_name_map__new(get_counter_name_hash_fn,
get_counter_name_hashmap_equal_fn,
/*ctx=*/NULL);
--
2.56.1.703.gf848ed807c-goog