1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/types.h>
6 #include <linux/rbtree.h>
12 struct cpu_topology_map {
18 struct cpu_cache_level {
32 struct perf_cpu_map *map;
48 unsigned int max_branches;
62 unsigned long long total_mem;
63 unsigned int msr_pmu_type;
64 unsigned int max_branches;
70 int nr_sibling_threads;
77 int nr_pmus_with_caps;
79 const char **cmdline_argv;
82 char *sibling_threads;
85 struct cpu_topology_map *cpu;
86 struct cpu_cache_level *caches;
93 struct numa_node *numa_nodes;
94 struct memory_node *memory_nodes;
95 unsigned long long memory_bsize;
96 struct hybrid_node *hybrid_nodes;
97 struct pmu_caps *pmu_caps;
98 #ifdef HAVE_LIBBPF_SUPPORT
100 * bpf_info_lock protects bpf rbtrees. This is needed because the
101 * trees are accessed by different threads in perf-top
104 struct rw_semaphore lock;
105 struct rb_root infos;
110 #endif // HAVE_LIBBPF_SUPPORT
111 /* same reason as above (for perf-top) */
113 struct rw_semaphore lock;
117 /* For fast cpu to numa node lookup via perf_env__numa_node */
121 /* For real clock time reference. */
128 * enabled is valid for report mode, and is true if above
129 * values are set, it's set in process_clock_data
135 enum perf_compress_type {
141 struct bpf_prog_info_node;
144 extern struct perf_env perf_env;
146 void perf_env__exit(struct perf_env *env);
148 int perf_env__kernel_is_64_bit(struct perf_env *env);
150 int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[]);
152 int perf_env__read_cpuid(struct perf_env *env);
153 int perf_env__read_pmu_mappings(struct perf_env *env);
154 int perf_env__nr_pmu_mappings(struct perf_env *env);
155 const char *perf_env__pmu_mappings(struct perf_env *env);
157 int perf_env__read_cpu_topology_map(struct perf_env *env);
159 void cpu_cache_level__free(struct cpu_cache_level *cache);
161 const char *perf_env__arch(struct perf_env *env);
162 const char *perf_env__cpuid(struct perf_env *env);
163 const char *perf_env__raw_arch(struct perf_env *env);
164 int perf_env__nr_cpus_avail(struct perf_env *env);
166 void perf_env__init(struct perf_env *env);
167 void perf_env__insert_bpf_prog_info(struct perf_env *env,
168 struct bpf_prog_info_node *info_node);
169 struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
171 bool perf_env__insert_btf(struct perf_env *env, struct btf_node *btf_node);
172 struct btf_node *perf_env__find_btf(struct perf_env *env, __u32 btf_id);
174 int perf_env__numa_node(struct perf_env *env, struct perf_cpu cpu);
175 char *perf_env__find_pmu_cap(struct perf_env *env, const char *pmu_name,
177 #endif /* __PERF_ENV_H */