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