1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include <linux/bitmap.h>
6 #include <linux/compiler.h>
7 #include <linux/perf_event.h>
10 #include "parse-events.h"
13 PERF_PMU_FORMAT_VALUE_CONFIG
,
14 PERF_PMU_FORMAT_VALUE_CONFIG1
,
15 PERF_PMU_FORMAT_VALUE_CONFIG2
,
18 #define PERF_PMU_FORMAT_BITS 64
20 struct perf_event_attr
;
27 struct perf_event_attr
*default_config
;
29 struct list_head format
; /* HEAD struct perf_pmu_format -> list */
30 struct list_head aliases
; /* HEAD struct perf_pmu_alias -> list */
31 struct list_head list
; /* ELEM */
32 int (*set_drv_config
) (struct perf_evsel_config_term
*term
);
35 struct perf_pmu_info
{
37 const char *metric_expr
;
38 const char *metric_name
;
44 #define UNIT_MAX_LEN 31 /* max length for event unit name */
46 struct perf_pmu_alias
{
52 struct list_head terms
; /* HEAD struct parse_events_term -> list */
53 struct list_head list
; /* ELEM */
54 char unit
[UNIT_MAX_LEN
+1];
62 struct perf_pmu
*perf_pmu__find(const char *name
);
63 int perf_pmu__config(struct perf_pmu
*pmu
, struct perf_event_attr
*attr
,
64 struct list_head
*head_terms
,
65 struct parse_events_error
*error
);
66 int perf_pmu__config_terms(struct list_head
*formats
,
67 struct perf_event_attr
*attr
,
68 struct list_head
*head_terms
,
69 bool zero
, struct parse_events_error
*error
);
70 __u64
perf_pmu__format_bits(struct list_head
*formats
, const char *name
);
71 int perf_pmu__check_alias(struct perf_pmu
*pmu
, struct list_head
*head_terms
,
72 struct perf_pmu_info
*info
);
73 struct list_head
*perf_pmu__alias(struct perf_pmu
*pmu
,
74 struct list_head
*head_terms
);
75 int perf_pmu_wrap(void);
76 void perf_pmu_error(struct list_head
*list
, char *name
, char const *msg
);
78 int perf_pmu__new_format(struct list_head
*list
, char *name
,
79 int config
, unsigned long *bits
);
80 void perf_pmu__set_format(unsigned long *bits
, long from
, long to
);
81 int perf_pmu__format_parse(char *dir
, struct list_head
*head
);
83 struct perf_pmu
*perf_pmu__scan(struct perf_pmu
*pmu
);
85 void print_pmu_events(const char *event_glob
, bool name_only
, bool quiet
,
86 bool long_desc
, bool details_flag
);
87 bool pmu_have_event(const char *pname
, const char *name
);
89 int perf_pmu__scan_file(struct perf_pmu
*pmu
, const char *name
, const char *fmt
, ...) __scanf(3, 4);
91 int perf_pmu__test(void);
93 struct perf_event_attr
*perf_pmu__get_default_config(struct perf_pmu
*pmu
);
95 struct pmu_events_map
*perf_pmu__find_map(struct perf_pmu
*pmu
);