xref: /linux/tools/perf/util/cpumap.h (revision a14bb7a6fd4a3d563ca971daf462ba4dc294a7a6)
1a12b51c4SPaul Mackerras #ifndef __PERF_CPUMAP_H
2a12b51c4SPaul Mackerras #define __PERF_CPUMAP_H
3a12b51c4SPaul Mackerras 
49ae7d335SArnaldo Carvalho de Melo #include <stdio.h>
5*a14bb7a6SArnaldo Carvalho de Melo #include <stdbool.h>
69ae7d335SArnaldo Carvalho de Melo 
760d567e2SArnaldo Carvalho de Melo struct cpu_map {
860d567e2SArnaldo Carvalho de Melo 	int nr;
960d567e2SArnaldo Carvalho de Melo 	int map[];
1060d567e2SArnaldo Carvalho de Melo };
1160d567e2SArnaldo Carvalho de Melo 
1260d567e2SArnaldo Carvalho de Melo struct cpu_map *cpu_map__new(const char *cpu_list);
1360d567e2SArnaldo Carvalho de Melo struct cpu_map *cpu_map__dummy_new(void);
14915fce20SArnaldo Carvalho de Melo void cpu_map__delete(struct cpu_map *map);
157ae92e74SYan, Zheng struct cpu_map *cpu_map__read(FILE *file);
169ae7d335SArnaldo Carvalho de Melo size_t cpu_map__fprintf(struct cpu_map *map, FILE *fp);
179ae7d335SArnaldo Carvalho de Melo 
18*a14bb7a6SArnaldo Carvalho de Melo static inline int cpu_map__nr(const struct cpu_map *map)
19*a14bb7a6SArnaldo Carvalho de Melo {
20*a14bb7a6SArnaldo Carvalho de Melo 	return map ? map->nr : 1;
21*a14bb7a6SArnaldo Carvalho de Melo }
22*a14bb7a6SArnaldo Carvalho de Melo 
23*a14bb7a6SArnaldo Carvalho de Melo static inline bool cpu_map__all(const struct cpu_map *map)
24*a14bb7a6SArnaldo Carvalho de Melo {
25*a14bb7a6SArnaldo Carvalho de Melo 	return map ? map->map[0] == -1 : true;
26*a14bb7a6SArnaldo Carvalho de Melo }
27*a14bb7a6SArnaldo Carvalho de Melo 
28a12b51c4SPaul Mackerras #endif /* __PERF_CPUMAP_H */
29