.. | .. |
---|
3 | 3 | #define __PERF_ENV_H |
---|
4 | 4 | |
---|
5 | 5 | #include <linux/types.h> |
---|
6 | | -#include "cpumap.h" |
---|
| 6 | +#include <linux/rbtree.h> |
---|
| 7 | +#include "rwsem.h" |
---|
| 8 | + |
---|
| 9 | +struct perf_cpu_map; |
---|
7 | 10 | |
---|
8 | 11 | struct cpu_topology_map { |
---|
9 | 12 | int socket_id; |
---|
| 13 | + int die_id; |
---|
10 | 14 | int core_id; |
---|
11 | 15 | }; |
---|
12 | 16 | |
---|
.. | .. |
---|
24 | 28 | u32 node; |
---|
25 | 29 | u64 mem_total; |
---|
26 | 30 | u64 mem_free; |
---|
27 | | - struct cpu_map *map; |
---|
| 31 | + struct perf_cpu_map *map; |
---|
28 | 32 | }; |
---|
29 | 33 | |
---|
30 | 34 | struct memory_node { |
---|
.. | .. |
---|
44 | 48 | char *cpuid; |
---|
45 | 49 | unsigned long long total_mem; |
---|
46 | 50 | unsigned int msr_pmu_type; |
---|
| 51 | + unsigned int max_branches; |
---|
47 | 52 | |
---|
48 | 53 | int nr_cmdline; |
---|
49 | 54 | int nr_sibling_cores; |
---|
| 55 | + int nr_sibling_dies; |
---|
50 | 56 | int nr_sibling_threads; |
---|
51 | 57 | int nr_numa_nodes; |
---|
52 | 58 | int nr_memory_nodes; |
---|
53 | 59 | int nr_pmu_mappings; |
---|
54 | 60 | int nr_groups; |
---|
| 61 | + int nr_cpu_pmu_caps; |
---|
55 | 62 | char *cmdline; |
---|
56 | 63 | const char **cmdline_argv; |
---|
57 | 64 | char *sibling_cores; |
---|
| 65 | + char *sibling_dies; |
---|
58 | 66 | char *sibling_threads; |
---|
59 | 67 | char *pmu_mappings; |
---|
| 68 | + char *cpu_pmu_caps; |
---|
60 | 69 | struct cpu_topology_map *cpu; |
---|
61 | 70 | struct cpu_cache_level *caches; |
---|
62 | 71 | int caches_cnt; |
---|
| 72 | + u32 comp_ratio; |
---|
| 73 | + u32 comp_ver; |
---|
| 74 | + u32 comp_type; |
---|
| 75 | + u32 comp_level; |
---|
| 76 | + u32 comp_mmap_len; |
---|
63 | 77 | struct numa_node *numa_nodes; |
---|
64 | 78 | struct memory_node *memory_nodes; |
---|
65 | 79 | unsigned long long memory_bsize; |
---|
| 80 | + |
---|
| 81 | + /* |
---|
| 82 | + * bpf_info_lock protects bpf rbtrees. This is needed because the |
---|
| 83 | + * trees are accessed by different threads in perf-top |
---|
| 84 | + */ |
---|
| 85 | + struct { |
---|
| 86 | + struct rw_semaphore lock; |
---|
| 87 | + struct rb_root infos; |
---|
| 88 | + u32 infos_cnt; |
---|
| 89 | + struct rb_root btfs; |
---|
| 90 | + u32 btfs_cnt; |
---|
| 91 | + } bpf_progs; |
---|
| 92 | + |
---|
| 93 | + /* same reason as above (for perf-top) */ |
---|
| 94 | + struct { |
---|
| 95 | + struct rw_semaphore lock; |
---|
| 96 | + struct rb_root tree; |
---|
| 97 | + } cgroups; |
---|
| 98 | + |
---|
| 99 | + /* For fast cpu to numa node lookup via perf_env__numa_node */ |
---|
| 100 | + int *numa_map; |
---|
| 101 | + int nr_numa_map; |
---|
| 102 | + |
---|
| 103 | + /* For real clock time reference. */ |
---|
| 104 | + struct { |
---|
| 105 | + u64 tod_ns; |
---|
| 106 | + u64 clockid_ns; |
---|
| 107 | + u64 clockid_res_ns; |
---|
| 108 | + int clockid; |
---|
| 109 | + /* |
---|
| 110 | + * enabled is valid for report mode, and is true if above |
---|
| 111 | + * values are set, it's set in process_clock_data |
---|
| 112 | + */ |
---|
| 113 | + bool enabled; |
---|
| 114 | + } clock; |
---|
66 | 115 | }; |
---|
| 116 | + |
---|
| 117 | +enum perf_compress_type { |
---|
| 118 | + PERF_COMP_NONE = 0, |
---|
| 119 | + PERF_COMP_ZSTD, |
---|
| 120 | + PERF_COMP_MAX |
---|
| 121 | +}; |
---|
| 122 | + |
---|
| 123 | +struct bpf_prog_info_node; |
---|
| 124 | +struct btf_node; |
---|
67 | 125 | |
---|
68 | 126 | extern struct perf_env perf_env; |
---|
69 | 127 | |
---|
.. | .. |
---|
71 | 129 | |
---|
72 | 130 | int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[]); |
---|
73 | 131 | |
---|
| 132 | +int perf_env__read_cpuid(struct perf_env *env); |
---|
74 | 133 | int perf_env__read_cpu_topology_map(struct perf_env *env); |
---|
75 | 134 | |
---|
76 | 135 | void cpu_cache_level__free(struct cpu_cache_level *cache); |
---|
.. | .. |
---|
79 | 138 | const char *perf_env__raw_arch(struct perf_env *env); |
---|
80 | 139 | int perf_env__nr_cpus_avail(struct perf_env *env); |
---|
81 | 140 | |
---|
| 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, |
---|
| 145 | + __u32 prog_id); |
---|
| 146 | +bool 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); |
---|
| 148 | + |
---|
| 149 | +int perf_env__numa_node(struct perf_env *env, int cpu); |
---|
82 | 150 | #endif /* __PERF_ENV_H */ |
---|