xref: /freebsd/lib/libpmc/pmu-events/pmu-events.h (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
1 /*
2  */
3 
4 #ifndef PMU_EVENTS_H
5 #define PMU_EVENTS_H
6 
7 enum aggr_mode_class {
8 	PerChip = 1,
9 	PerCore
10 };
11 
12 /*
13  * Describe each PMU event. Each CPU has a table of PMU events.
14  */
15 struct pmu_event {
16 	const char *name;
17 	const char *compat;
18 	const char *event;
19 	const char *desc;
20 	const char *topic;
21 	const char *long_desc;
22 	const char *pmu;
23 	const char *unit;
24 	const char *perpkg;
25 	const char *aggr_mode;
26 	const char *metric_expr;
27 	const char *metric_name;
28 	const char *metric_group;
29 	const char *deprecated;
30 	const char *metric_constraint;
31 };
32 
33 /*
34  *
35  * Map a CPU to its table of PMU events. The CPU is identified by the
36  * cpuid field, which is an arch-specific identifier for the CPU.
37  * The identifier specified in tools/perf/pmu-events/arch/xxx/mapfile
38  * must match the get_cpuid_str() in tools/perf/arch/xxx/util/header.c)
39  *
40  * The  cpuid can contain any character other than the comma.
41  */
42 struct pmu_events_map {
43 	const char *cpuid;
44 	const char *version;
45 	const char *type;		/* core, uncore etc */
46 	const struct pmu_event *table;
47 };
48 
49 struct pmu_sys_events {
50 	const char *name;
51 	const struct pmu_event *table;
52 };
53 
54 /*
55  * Global table mapping each known CPU for the architecture to its
56  * table of PMU events.
57  */
58 extern const struct pmu_events_map pmu_events_map[];
59 extern const struct pmu_sys_events pmu_sys_event_tables[];
60 
61 #endif
62