xref: /openbmc/linux/tools/perf/util/pmu.h (revision 39b6f3aa)
1 #ifndef __PMU_H
2 #define __PMU_H
3 
4 #include <linux/bitops.h>
5 #include <linux/perf_event.h>
6 
7 enum {
8 	PERF_PMU_FORMAT_VALUE_CONFIG,
9 	PERF_PMU_FORMAT_VALUE_CONFIG1,
10 	PERF_PMU_FORMAT_VALUE_CONFIG2,
11 };
12 
13 #define PERF_PMU_FORMAT_BITS 64
14 
15 struct perf_pmu {
16 	char *name;
17 	__u32 type;
18 	struct cpu_map *cpus;
19 	struct list_head format;
20 	struct list_head aliases;
21 	struct list_head list;
22 };
23 
24 struct perf_pmu *perf_pmu__find(char *name);
25 int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr,
26 		     struct list_head *head_terms);
27 int perf_pmu__config_terms(struct list_head *formats,
28 			   struct perf_event_attr *attr,
29 			   struct list_head *head_terms);
30 int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms);
31 struct list_head *perf_pmu__alias(struct perf_pmu *pmu,
32 				  struct list_head *head_terms);
33 int perf_pmu_wrap(void);
34 void perf_pmu_error(struct list_head *list, char *name, char const *msg);
35 
36 int perf_pmu__new_format(struct list_head *list, char *name,
37 			 int config, unsigned long *bits);
38 void perf_pmu__set_format(unsigned long *bits, long from, long to);
39 int perf_pmu__format_parse(char *dir, struct list_head *head);
40 
41 struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
42 
43 int perf_pmu__test(void);
44 #endif /* __PMU_H */
45