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