mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
perf cpu_map: Add cpu_map__empty_new function
Adding cpu_map__empty_new interface to create empty cpumap with given size. The cpumap entries are initialized with -1. It'll be used for caching cpu_map in following patches. Signed-off-by: Jiri Olsa <[email protected]> Tested-by: Kan Liang <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
af33998174
commit
2322f573f8
2 changed files with 18 additions and 0 deletions
|
|
@ -203,6 +203,23 @@ struct cpu_map *cpu_map__dummy_new(void)
|
|||
return cpus;
|
||||
}
|
||||
|
||||
struct cpu_map *cpu_map__empty_new(int nr)
|
||||
{
|
||||
struct cpu_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;
|
||||
|
||||
atomic_set(&cpus->refcnt, 1);
|
||||
}
|
||||
|
||||
return cpus;
|
||||
}
|
||||
|
||||
static void cpu_map__delete(struct cpu_map *map)
|
||||
{
|
||||
if (map) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ struct cpu_map {
|
|||
};
|
||||
|
||||
struct cpu_map *cpu_map__new(const char *cpu_list);
|
||||
struct cpu_map *cpu_map__empty_new(int nr);
|
||||
struct cpu_map *cpu_map__dummy_new(void);
|
||||
struct cpu_map *cpu_map__read(FILE *file);
|
||||
size_t cpu_map__fprintf(struct cpu_map *map, FILE *fp);
|
||||
|
|
|
|||
Loading…
Reference in a new issue