1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef PMU_EVENTS_H
3 #define PMU_EVENTS_H
4 
5 struct perf_pmu;
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 typedef int (*pmu_event_iter_fn)(const struct pmu_event *pe,
34 				 const struct pmu_event *table,
35 				 void *data);
36 
37 const struct pmu_event *perf_pmu__find_table(struct perf_pmu *pmu);
38 const struct pmu_event *find_core_events_table(const char *arch, const char *cpuid);
39 int pmu_for_each_core_event(pmu_event_iter_fn fn, void *data);
40 
41 const struct pmu_event *find_sys_events_table(const char *name);
42 int pmu_for_each_sys_event(pmu_event_iter_fn fn, void *data);
43 
44 #endif
45