xref: /linux/tools/perf/util/env.h (revision 0883c2c06fb5bcf5b9e008270827e63c09a88c1e)
1 #ifndef __PERF_ENV_H
2 #define __PERF_ENV_H
3 
4 #include <linux/types.h>
5 
6 struct cpu_topology_map {
7 	int	socket_id;
8 	int	core_id;
9 };
10 
11 struct cpu_cache_level {
12 	u32	level;
13 	u32	line_size;
14 	u32	sets;
15 	u32	ways;
16 	char	*type;
17 	char	*size;
18 	char	*map;
19 };
20 
21 struct perf_env {
22 	char			*hostname;
23 	char			*os_release;
24 	char			*version;
25 	char			*arch;
26 	int			nr_cpus_online;
27 	int			nr_cpus_avail;
28 	char			*cpu_desc;
29 	char			*cpuid;
30 	unsigned long long	total_mem;
31 	unsigned int		msr_pmu_type;
32 
33 	int			nr_cmdline;
34 	int			nr_sibling_cores;
35 	int			nr_sibling_threads;
36 	int			nr_numa_nodes;
37 	int			nr_pmu_mappings;
38 	int			nr_groups;
39 	char			*cmdline;
40 	const char		**cmdline_argv;
41 	char			*sibling_cores;
42 	char			*sibling_threads;
43 	char			*numa_nodes;
44 	char			*pmu_mappings;
45 	struct cpu_topology_map	*cpu;
46 	struct cpu_cache_level	*caches;
47 	int			 caches_cnt;
48 };
49 
50 extern struct perf_env perf_env;
51 
52 void perf_env__exit(struct perf_env *env);
53 
54 int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[]);
55 
56 int perf_env__read_cpu_topology_map(struct perf_env *env);
57 
58 void cpu_cache_level__free(struct cpu_cache_level *cache);
59 #endif /* __PERF_ENV_H */
60