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