2386212b1df005ac77bed50e8e43a3a026608370
[linux-2.6-microblaze.git] / tools / perf / pmu-events / pmu-events.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef PMU_EVENTS_H
3 #define PMU_EVENTS_H
4
5 enum aggr_mode_class {
6         PerChip = 1,
7         PerCore
8 };
9
10 /*
11  * Describe each PMU event. Each CPU has a table of PMU events.
12  */
13 struct pmu_event {
14         const char *name;
15         const char *compat;
16         const char *event;
17         const char *desc;
18         const char *topic;
19         const char *long_desc;
20         const char *pmu;
21         const char *unit;
22         const char *perpkg;
23         const char *aggr_mode;
24         const char *metric_expr;
25         const char *metric_name;
26         const char *metric_group;
27         const char *deprecated;
28         const char *metric_constraint;
29 };
30
31 /*
32  *
33  * Map a CPU to its table of PMU events. The CPU is identified by the
34  * cpuid field, which is an arch-specific identifier for the CPU.
35  * The identifier specified in tools/perf/pmu-events/arch/xxx/mapfile
36  * must match the get_cpuid_str() in tools/perf/arch/xxx/util/header.c)
37  *
38  * The  cpuid can contain any character other than the comma.
39  */
40 struct pmu_events_map {
41         const char *arch;
42         const char *cpuid;
43         const struct pmu_event *table;
44 };
45
46 /*
47  * Global table mapping each known CPU for the architecture to its
48  * table of PMU events.
49  */
50 extern const struct pmu_events_map pmu_events_map[];
51
52 const struct pmu_event *find_sys_events_table(const char *name);
53
54 typedef int (*pmu_event_iter_fn)(const struct pmu_event *pe, void *data);
55 int pmu_for_each_sys_event(pmu_event_iter_fn fn, void *data);
56
57 #endif