static void cpu_aggr_map__delete(struct cpu_aggr_map *map)
{
- if (map) {
- WARN_ONCE(refcount_read(&map->refcnt) != 0,
- "cpu_aggr_map refcnt unbalanced\n");
- free(map);
- }
-}
-
-static void cpu_aggr_map__put(struct cpu_aggr_map *map)
-{
- if (map && refcount_dec_and_test(&map->refcnt))
- cpu_aggr_map__delete(map);
+ free(map);
}
static void perf_stat__exit_aggr_mode(void)
{
- cpu_aggr_map__put(stat_config.aggr_map);
- cpu_aggr_map__put(stat_config.cpus_aggr_map);
+ cpu_aggr_map__delete(stat_config.aggr_map);
+ cpu_aggr_map__delete(stat_config.cpus_aggr_map);
stat_config.aggr_map = NULL;
stat_config.cpus_aggr_map = NULL;
}
#include <stdbool.h>
#include <stdio.h>
#include <perf/cpumap.h>
-#include <linux/refcount.h>
/** Identify where counts are aggregated, -1 implies not to aggregate. */
struct aggr_cpu_id {
/** A collection of aggr_cpu_id values, the "built" version is sorted and uniqued. */
struct cpu_aggr_map {
- refcount_t refcnt;
/** Number of valid entries. */
int nr;
/** The entries. */