mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
perf cpumap: Add new map type for aggregation
Currently this is a duplicate of perf_cpu_map so that it can be used as a drop in replacement. In a later commit it will be changed from a map of ints to use the new cpu_aggr_id struct. No functional changes. Signed-off-by: James Clark <james.clark@arm.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@redhat.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Tested-by: John Garry <john.garry@huawei.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Richter <tmricht@linux.ibm.com> Link: https://lore.kernel.org/r/20201126141328.6509-6-james.clark@arm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
2760f5a14f
commit
cea6575fdc
@ -95,6 +95,23 @@ struct perf_cpu_map *perf_cpu_map__empty_new(int nr)
|
||||
return cpus;
|
||||
}
|
||||
|
||||
struct cpu_aggr_map *cpu_aggr_map__empty_new(int nr)
|
||||
{
|
||||
struct cpu_aggr_map *cpus = malloc(sizeof(*cpus) + sizeof(int) * nr);
|
||||
|
||||
if (cpus != NULL) {
|
||||
int i;
|
||||
|
||||
cpus->nr = nr;
|
||||
for (i = 0; i < nr; i++)
|
||||
cpus->map[i] = -1;
|
||||
|
||||
refcount_set(&cpus->refcnt, 1);
|
||||
}
|
||||
|
||||
return cpus;
|
||||
}
|
||||
|
||||
static int cpu__get_topology_int(int cpu, const char *name, int *value)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
@ -11,9 +11,17 @@ struct aggr_cpu_id {
|
||||
int id;
|
||||
};
|
||||
|
||||
struct cpu_aggr_map {
|
||||
refcount_t refcnt;
|
||||
int nr;
|
||||
int map[];
|
||||
};
|
||||
|
||||
struct perf_record_cpu_map_data;
|
||||
|
||||
struct perf_cpu_map *perf_cpu_map__empty_new(int nr);
|
||||
struct cpu_aggr_map *cpu_aggr_map__empty_new(int nr);
|
||||
|
||||
struct perf_cpu_map *cpu_map__new_data(struct perf_record_cpu_map_data *data);
|
||||
size_t cpu_map__snprint(struct perf_cpu_map *map, char *buf, size_t size);
|
||||
size_t cpu_map__snprint_mask(struct perf_cpu_map *map, char *buf, size_t size);
|
||||
|
Loading…
Reference in New Issue
Block a user