blob: 9aace8452751ca25692093acb46bbaad139d56d8 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001/* 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
8struct cpu_topology_map {
9 int socket_id;
10 int core_id;
11};
12
13struct 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
23struct numa_node {
24 u32 node;
25 u64 mem_total;
26 u64 mem_free;
27 struct cpu_map *map;
28};
29
30struct 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
59extern struct perf_env perf_env;
60
61void perf_env__exit(struct perf_env *env);
62
63int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[]);
64
65int perf_env__read_cpu_topology_map(struct perf_env *env);
66
67void cpu_cache_level__free(struct cpu_cache_level *cache);
68
69const char *perf_env__raw_arch(struct perf_env *env);
70int perf_env__nr_cpus_avail(struct perf_env *env);
71
72#endif /* __PERF_ENV_H */