xref: /freebsd/lib/libpmc/pmu-events/pmu-events.h (revision 6ad94d549eb2286d791abd5634400d8ef36d8259)
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_threshold;
28 	const char *metric_name;
29 	const char *metric_group;
30 	const char *metric_group_nogroup;
31 	const char *default_metric_group;
32 	const char *deprecated;
33 	const char *metric_constraint;
34 };
35 
36 /*
37  *
38  * Map a CPU to its table of PMU events. The CPU is identified by the
39  * cpuid field, which is an arch-specific identifier for the CPU.
40  * The identifier specified in tools/perf/pmu-events/arch/xxx/mapfile
41  * must match the get_cpuid_str() in tools/perf/arch/xxx/util/header.c)
42  *
43  * The  cpuid can contain any character other than the comma.
44  */
45 struct pmu_events_map {
46 	const char *cpuid;
47 	const char *version;
48 	const char *type;		/* core, uncore etc */
49 	const struct pmu_event *table;
50 };
51 
52 struct pmu_sys_events {
53 	const char *name;
54 	const struct pmu_event *table;
55 };
56 
57 /*
58  * Global table mapping each known CPU for the architecture to its
59  * table of PMU events.
60  */
61 extern const struct pmu_events_map pmu_events_map[];
62 extern const struct pmu_sys_events pmu_sys_event_tables[];
63 
64 #endif
65