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