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 struct pmu_events_table;
34 
35 typedef int (*pmu_event_iter_fn)(const struct pmu_event *pe,
36 				 const struct pmu_events_table *table,
37 				 void *data);
38 
39 int pmu_events_table_for_each_event(const struct pmu_events_table *table, pmu_event_iter_fn fn,
40 				    void *data);
41 
42 const struct pmu_events_table *perf_pmu__find_table(struct perf_pmu *pmu);
43 const struct pmu_events_table *find_core_events_table(const char *arch, const char *cpuid);
44 int pmu_for_each_core_event(pmu_event_iter_fn fn, void *data);
45 
46 const struct pmu_events_table *find_sys_events_table(const char *name);
47 int pmu_for_each_sys_event(pmu_event_iter_fn fn, void *data);
48 
49 #endif
50