1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_BPF_COUNTER_H
3 #define __PERF_BPF_COUNTER_H 1
5 #include <linux/list.h>
11 typedef int (*bpf_counter_evsel_op)(struct evsel *evsel);
12 typedef int (*bpf_counter_evsel_target_op)(struct evsel *evsel,
13 struct target *target);
14 typedef int (*bpf_counter_evsel_install_pe_op)(struct evsel *evsel,
18 struct bpf_counter_ops {
19 bpf_counter_evsel_target_op load;
20 bpf_counter_evsel_op enable;
21 bpf_counter_evsel_op read;
22 bpf_counter_evsel_op destroy;
23 bpf_counter_evsel_install_pe_op install_pe;
28 struct list_head list;
33 int bpf_counter__load(struct evsel *evsel, struct target *target);
34 int bpf_counter__enable(struct evsel *evsel);
35 int bpf_counter__read(struct evsel *evsel);
36 void bpf_counter__destroy(struct evsel *evsel);
37 int bpf_counter__install_pe(struct evsel *evsel, int cpu, int fd);
39 #else /* HAVE_BPF_SKEL */
43 static inline int bpf_counter__load(struct evsel *evsel __maybe_unused,
44 struct target *target __maybe_unused)
49 static inline int bpf_counter__enable(struct evsel *evsel __maybe_unused)
54 static inline int bpf_counter__read(struct evsel *evsel __maybe_unused)
59 static inline void bpf_counter__destroy(struct evsel *evsel __maybe_unused)
63 static inline int bpf_counter__install_pe(struct evsel *evsel __maybe_unused,
64 int cpu __maybe_unused,
65 int fd __maybe_unused)
70 #endif /* HAVE_BPF_SKEL */
72 #endif /* __PERF_BPF_COUNTER_H */