Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef PMU_EVENTS_H
3#define PMU_EVENTS_H
4
5/*
6 * Describe each PMU event. Each CPU has a table of PMU events.
7 */
8struct pmu_event {
9 const char *name;
10 const char *event;
11 const char *desc;
12 const char *topic;
13 const char *long_desc;
14 const char *pmu;
15 const char *unit;
16 const char *perpkg;
17 const char *metric_expr;
18 const char *metric_name;
19 const char *metric_group;
20};
21
22/*
23 *
24 * Map a CPU to its table of PMU events. The CPU is identified by the
25 * cpuid field, which is an arch-specific identifier for the CPU.
26 * The identifier specified in tools/perf/pmu-events/arch/xxx/mapfile
27 * must match the get_cpustr() in tools/perf/arch/xxx/util/header.c)
28 *
29 * The cpuid can contain any character other than the comma.
30 */
31struct pmu_events_map {
32 const char *cpuid;
33 const char *version;
34 const char *type; /* core, uncore etc */
35 struct pmu_event *table;
36};
37
38/*
39 * Global table mapping each known CPU for the architecture to its
40 * table of PMU events.
41 */
42extern struct pmu_events_map pmu_events_map[];
43
44#endif
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef PMU_EVENTS_H
3#define PMU_EVENTS_H
4
5struct perf_pmu;
6
7enum 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 */
15struct 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
33struct pmu_events_table;
34
35typedef int (*pmu_event_iter_fn)(const struct pmu_event *pe,
36 const struct pmu_events_table *table,
37 void *data);
38
39int pmu_events_table_for_each_event(const struct pmu_events_table *table, pmu_event_iter_fn fn,
40 void *data);
41
42const struct pmu_events_table *perf_pmu__find_table(struct perf_pmu *pmu);
43const struct pmu_events_table *find_core_events_table(const char *arch, const char *cpuid);
44int pmu_for_each_core_event(pmu_event_iter_fn fn, void *data);
45
46const struct pmu_events_table *find_sys_events_table(const char *name);
47int pmu_for_each_sys_event(pmu_event_iter_fn fn, void *data);
48
49#endif