]>
Commit | Line | Data |
---|---|---|
cd82a32e JO |
1 | #ifndef __PMU_H |
2 | #define __PMU_H | |
3 | ||
d944c4ee | 4 | #include <linux/bitmap.h> |
d2709c7c | 5 | #include <linux/perf_event.h> |
dc098b35 | 6 | #include <stdbool.h> |
859442bd | 7 | #include "evsel.h" |
e64b020b | 8 | #include "parse-events.h" |
cd82a32e JO |
9 | |
10 | enum { | |
11 | PERF_PMU_FORMAT_VALUE_CONFIG, | |
12 | PERF_PMU_FORMAT_VALUE_CONFIG1, | |
13 | PERF_PMU_FORMAT_VALUE_CONFIG2, | |
14 | }; | |
15 | ||
16 | #define PERF_PMU_FORMAT_BITS 64 | |
17 | ||
dc0a6202 AH |
18 | struct perf_event_attr; |
19 | ||
cd82a32e JO |
20 | struct perf_pmu { |
21 | char *name; | |
22 | __u32 type; | |
42634bc7 | 23 | bool selectable; |
dc0a6202 | 24 | struct perf_event_attr *default_config; |
7ae92e74 | 25 | struct cpu_map *cpus; |
885b5930 CS |
26 | struct list_head format; /* HEAD struct perf_pmu_format -> list */ |
27 | struct list_head aliases; /* HEAD struct perf_pmu_alias -> list */ | |
28 | struct list_head list; /* ELEM */ | |
859442bd | 29 | int (*set_drv_config) (struct perf_evsel_config_term *term); |
cd82a32e JO |
30 | }; |
31 | ||
46441bdc MF |
32 | struct perf_pmu_info { |
33 | const char *unit; | |
34 | double scale; | |
044330c1 | 35 | bool per_pkg; |
1d9e446b | 36 | bool snapshot; |
46441bdc MF |
37 | }; |
38 | ||
dcb4e102 KL |
39 | #define UNIT_MAX_LEN 31 /* max length for event unit name */ |
40 | ||
41 | struct perf_pmu_alias { | |
42 | char *name; | |
43 | struct list_head terms; /* HEAD struct parse_events_term -> list */ | |
44 | struct list_head list; /* ELEM */ | |
45 | char unit[UNIT_MAX_LEN+1]; | |
46 | double scale; | |
044330c1 | 47 | bool per_pkg; |
1d9e446b | 48 | bool snapshot; |
dcb4e102 KL |
49 | }; |
50 | ||
b6b96fb4 | 51 | struct perf_pmu *perf_pmu__find(const char *name); |
cd82a32e | 52 | int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr, |
e64b020b JO |
53 | struct list_head *head_terms, |
54 | struct parse_events_error *error); | |
cff7f956 JO |
55 | int perf_pmu__config_terms(struct list_head *formats, |
56 | struct perf_event_attr *attr, | |
dc0a6202 | 57 | struct list_head *head_terms, |
e64b020b | 58 | bool zero, struct parse_events_error *error); |
09ff6071 | 59 | __u64 perf_pmu__format_bits(struct list_head *formats, const char *name); |
410136f5 | 60 | int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, |
46441bdc | 61 | struct perf_pmu_info *info); |
a6146d50 | 62 | struct list_head *perf_pmu__alias(struct perf_pmu *pmu, |
5c6ccc37 | 63 | struct list_head *head_terms); |
cd82a32e JO |
64 | int perf_pmu_wrap(void); |
65 | void perf_pmu_error(struct list_head *list, char *name, char const *msg); | |
66 | ||
67 | int perf_pmu__new_format(struct list_head *list, char *name, | |
68 | int config, unsigned long *bits); | |
69 | void perf_pmu__set_format(unsigned long *bits, long from, long to); | |
cff7f956 | 70 | int perf_pmu__format_parse(char *dir, struct list_head *head); |
cd82a32e | 71 | |
50a9667c RR |
72 | struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); |
73 | ||
dc098b35 | 74 | void print_pmu_events(const char *event_glob, bool name_only); |
4cabc3d1 | 75 | bool pmu_have_event(const char *pname, const char *name); |
dc098b35 | 76 | |
7d4bdab5 AH |
77 | int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, |
78 | ...) __attribute__((format(scanf, 3, 4))); | |
79 | ||
cd82a32e | 80 | int perf_pmu__test(void); |
dc0a6202 AH |
81 | |
82 | struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu); | |
83 | ||
cd82a32e | 84 | #endif /* __PMU_H */ |