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;
45 struct hybrid_cpc_node {
47 unsigned int max_branches;
61 unsigned long long total_mem;
62 unsigned int msr_pmu_type;
63 unsigned int max_branches;
68 int nr_sibling_threads;
75 int nr_hybrid_cpc_nodes;
77 const char **cmdline_argv;
80 char *sibling_threads;
83 struct cpu_topology_map *cpu;
84 struct cpu_cache_level *caches;
91 struct numa_node *numa_nodes;
92 struct memory_node *memory_nodes;
93 unsigned long long memory_bsize;
94 struct hybrid_node *hybrid_nodes;
95 struct hybrid_cpc_node *hybrid_cpc_nodes;
96 #ifdef HAVE_LIBBPF_SUPPORT
98 * bpf_info_lock protects bpf rbtrees. This is needed because the
99 * trees are accessed by different threads in perf-top
102 struct rw_semaphore lock;
103 struct rb_root infos;
108 #endif // HAVE_LIBBPF_SUPPORT
109 /* same reason as above (for perf-top) */
111 struct rw_semaphore lock;
115 /* For fast cpu to numa node lookup via perf_env__numa_node */
119 /* For real clock time reference. */
126 * enabled is valid for report mode, and is true if above
127 * values are set, it's set in process_clock_data
133 enum perf_compress_type {
139 struct bpf_prog_info_node;
142 extern struct perf_env perf_env;
144 void perf_env__exit(struct perf_env *env);
146 int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[]);
148 int perf_env__read_cpuid(struct perf_env *env);
149 int perf_env__read_cpu_topology_map(struct perf_env *env);
151 void cpu_cache_level__free(struct cpu_cache_level *cache);
153 const char *perf_env__arch(struct perf_env *env);
154 const char *perf_env__raw_arch(struct perf_env *env);
155 int perf_env__nr_cpus_avail(struct perf_env *env);
157 void perf_env__init(struct perf_env *env);
158 void perf_env__insert_bpf_prog_info(struct perf_env *env,
159 struct bpf_prog_info_node *info_node);
160 struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
162 void perf_env__insert_btf(struct perf_env *env, struct btf_node *btf_node);
163 struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id);
165 int perf_env__numa_node(struct perf_env *env, int cpu);
166 #endif /* __PERF_ENV_H */