| .. | .. |
|---|
| 6 | 6 | #include <linux/compiler.h> |
|---|
| 7 | 7 | #include <linux/perf_event.h> |
|---|
| 8 | 8 | #include <stdbool.h> |
|---|
| 9 | | -#include "evsel.h" |
|---|
| 10 | 9 | #include "parse-events.h" |
|---|
| 10 | +#include "pmu-events/pmu-events.h" |
|---|
| 11 | + |
|---|
| 12 | +struct evsel_config_term; |
|---|
| 11 | 13 | |
|---|
| 12 | 14 | enum { |
|---|
| 13 | 15 | PERF_PMU_FORMAT_VALUE_CONFIG, |
|---|
| 14 | 16 | PERF_PMU_FORMAT_VALUE_CONFIG1, |
|---|
| 15 | 17 | PERF_PMU_FORMAT_VALUE_CONFIG2, |
|---|
| 18 | + PERF_PMU_FORMAT_VALUE_CONFIG_END, |
|---|
| 16 | 19 | }; |
|---|
| 17 | 20 | |
|---|
| 18 | 21 | #define PERF_PMU_FORMAT_BITS 64 |
|---|
| 22 | +#define EVENT_SOURCE_DEVICE_PATH "/bus/event_source/devices/" |
|---|
| 19 | 23 | |
|---|
| 20 | 24 | struct perf_event_attr; |
|---|
| 25 | + |
|---|
| 26 | +struct perf_pmu_caps { |
|---|
| 27 | + char *name; |
|---|
| 28 | + char *value; |
|---|
| 29 | + struct list_head list; |
|---|
| 30 | +}; |
|---|
| 21 | 31 | |
|---|
| 22 | 32 | struct perf_pmu { |
|---|
| 23 | 33 | char *name; |
|---|
| 24 | 34 | __u32 type; |
|---|
| 25 | 35 | bool selectable; |
|---|
| 26 | 36 | bool is_uncore; |
|---|
| 37 | + bool auxtrace; |
|---|
| 38 | + int max_precise; |
|---|
| 27 | 39 | struct perf_event_attr *default_config; |
|---|
| 28 | | - struct cpu_map *cpus; |
|---|
| 40 | + struct perf_cpu_map *cpus; |
|---|
| 29 | 41 | struct list_head format; /* HEAD struct perf_pmu_format -> list */ |
|---|
| 30 | 42 | struct list_head aliases; /* HEAD struct perf_pmu_alias -> list */ |
|---|
| 43 | + struct list_head caps; /* HEAD struct perf_pmu_caps -> list */ |
|---|
| 31 | 44 | struct list_head list; /* ELEM */ |
|---|
| 32 | | - int (*set_drv_config) (struct perf_evsel_config_term *term); |
|---|
| 33 | 45 | }; |
|---|
| 46 | + |
|---|
| 47 | +extern struct perf_pmu perf_pmu__fake; |
|---|
| 34 | 48 | |
|---|
| 35 | 49 | struct perf_pmu_info { |
|---|
| 36 | 50 | const char *unit; |
|---|
| .. | .. |
|---|
| 55 | 69 | double scale; |
|---|
| 56 | 70 | bool per_pkg; |
|---|
| 57 | 71 | bool snapshot; |
|---|
| 72 | + bool deprecated; |
|---|
| 58 | 73 | char *metric_expr; |
|---|
| 59 | 74 | char *metric_name; |
|---|
| 60 | 75 | }; |
|---|
| 61 | 76 | |
|---|
| 62 | 77 | struct perf_pmu *perf_pmu__find(const char *name); |
|---|
| 78 | +struct perf_pmu *perf_pmu__find_by_type(unsigned int type); |
|---|
| 63 | 79 | int perf_pmu__config(struct perf_pmu *pmu, struct perf_event_attr *attr, |
|---|
| 64 | 80 | struct list_head *head_terms, |
|---|
| 65 | 81 | struct parse_events_error *error); |
|---|
| 66 | | -int perf_pmu__config_terms(struct list_head *formats, |
|---|
| 82 | +int perf_pmu__config_terms(const char *pmu_name, struct list_head *formats, |
|---|
| 67 | 83 | struct perf_event_attr *attr, |
|---|
| 68 | 84 | struct list_head *head_terms, |
|---|
| 69 | 85 | bool zero, struct parse_events_error *error); |
|---|
| 70 | 86 | __u64 perf_pmu__format_bits(struct list_head *formats, const char *name); |
|---|
| 87 | +int perf_pmu__format_type(struct list_head *formats, const char *name); |
|---|
| 71 | 88 | int perf_pmu__check_alias(struct perf_pmu *pmu, struct list_head *head_terms, |
|---|
| 72 | 89 | struct perf_pmu_info *info); |
|---|
| 73 | 90 | struct list_head *perf_pmu__alias(struct perf_pmu *pmu, |
|---|
| 74 | 91 | struct list_head *head_terms); |
|---|
| 75 | | -int perf_pmu_wrap(void); |
|---|
| 76 | 92 | void perf_pmu_error(struct list_head *list, char *name, char const *msg); |
|---|
| 77 | 93 | |
|---|
| 78 | 94 | int perf_pmu__new_format(struct list_head *list, char *name, |
|---|
| .. | .. |
|---|
| 83 | 99 | |
|---|
| 84 | 100 | struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu); |
|---|
| 85 | 101 | |
|---|
| 102 | +bool is_pmu_core(const char *name); |
|---|
| 86 | 103 | void print_pmu_events(const char *event_glob, bool name_only, bool quiet, |
|---|
| 87 | | - bool long_desc, bool details_flag); |
|---|
| 104 | + bool long_desc, bool details_flag, |
|---|
| 105 | + bool deprecated); |
|---|
| 88 | 106 | bool pmu_have_event(const char *pname, const char *name); |
|---|
| 89 | 107 | |
|---|
| 90 | 108 | int perf_pmu__scan_file(struct perf_pmu *pmu, const char *name, const char *fmt, ...) __scanf(3, 4); |
|---|
| .. | .. |
|---|
| 92 | 110 | int perf_pmu__test(void); |
|---|
| 93 | 111 | |
|---|
| 94 | 112 | struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu); |
|---|
| 113 | +void pmu_add_cpu_aliases_map(struct list_head *head, struct perf_pmu *pmu, |
|---|
| 114 | + struct pmu_events_map *map); |
|---|
| 95 | 115 | |
|---|
| 96 | 116 | struct pmu_events_map *perf_pmu__find_map(struct perf_pmu *pmu); |
|---|
| 117 | +bool pmu_uncore_alias_match(const char *pmu_name, const char *name); |
|---|
| 118 | +void perf_pmu_free_alias(struct perf_pmu_alias *alias); |
|---|
| 119 | + |
|---|
| 120 | +int perf_pmu__convert_scale(const char *scale, char **end, double *sval); |
|---|
| 121 | + |
|---|
| 122 | +int perf_pmu__caps_parse(struct perf_pmu *pmu); |
|---|
| 123 | + |
|---|
| 124 | +void perf_pmu__warn_invalid_config(struct perf_pmu *pmu, __u64 config, |
|---|
| 125 | + char *name); |
|---|
| 126 | +void perf_pmu__warn_invalid_formats(struct perf_pmu *pmu); |
|---|
| 97 | 127 | |
|---|
| 98 | 128 | #endif /* __PMU_H */ |
|---|