1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/types.h>
6 #include <linux/rbtree.h>
11 struct cpu_topology_map
{
17 struct cpu_cache_level
{
31 struct perf_cpu_map
*map
;
49 unsigned long long total_mem
;
50 unsigned int msr_pmu_type
;
51 unsigned int max_branches
;
56 int nr_sibling_threads
;
63 const char **cmdline_argv
;
66 char *sibling_threads
;
69 struct cpu_topology_map
*cpu
;
70 struct cpu_cache_level
*caches
;
77 struct numa_node
*numa_nodes
;
78 struct memory_node
*memory_nodes
;
79 unsigned long long memory_bsize
;
80 #ifdef HAVE_LIBBPF_SUPPORT
82 * bpf_info_lock protects bpf rbtrees. This is needed because the
83 * trees are accessed by different threads in perf-top
86 struct rw_semaphore lock
;
92 #endif // HAVE_LIBBPF_SUPPORT
93 /* same reason as above (for perf-top) */
95 struct rw_semaphore lock
;
99 /* For fast cpu to numa node lookup via perf_env__numa_node */
103 /* For real clock time reference. */
110 * enabled is valid for report mode, and is true if above
111 * values are set, it's set in process_clock_data
117 enum perf_compress_type
{
123 struct bpf_prog_info_node
;
126 extern struct perf_env perf_env
;
128 void perf_env__exit(struct perf_env
*env
);
130 int perf_env__set_cmdline(struct perf_env
*env
, int argc
, const char *argv
[]);
132 int perf_env__read_cpuid(struct perf_env
*env
);
133 int perf_env__read_cpu_topology_map(struct perf_env
*env
);
135 void cpu_cache_level__free(struct cpu_cache_level
*cache
);
137 const char *perf_env__arch(struct perf_env
*env
);
138 const char *perf_env__raw_arch(struct perf_env
*env
);
139 int perf_env__nr_cpus_avail(struct perf_env
*env
);
141 void perf_env__init(struct perf_env
*env
);
142 void perf_env__insert_bpf_prog_info(struct perf_env
*env
,
143 struct bpf_prog_info_node
*info_node
);
144 struct bpf_prog_info_node
*perf_env__find_bpf_prog_info(struct perf_env
*env
,
146 void perf_env__insert_btf(struct perf_env
*env
, struct btf_node
*btf_node
);
147 struct btf_node
*perf_env__find_btf(struct perf_env
*env
, __u32 btf_id
);
149 int perf_env__numa_node(struct perf_env
*env
, int cpu
);
150 #endif /* __PERF_ENV_H */