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 disable;
22 bpf_counter_evsel_op read;
23 bpf_counter_evsel_op destroy;
24 bpf_counter_evsel_install_pe_op install_pe;
29 struct list_head list;
34 int bpf_counter__load(struct evsel *evsel, struct target *target);
35 int bpf_counter__enable(struct evsel *evsel);
36 int bpf_counter__disable(struct evsel *evsel);
37 int bpf_counter__read(struct evsel *evsel);
38 void bpf_counter__destroy(struct evsel *evsel);
39 int bpf_counter__install_pe(struct evsel *evsel, int cpu, int fd);
41 #else /* HAVE_BPF_SKEL */
43 #include <linux/err.h>
45 static inline int bpf_counter__load(struct evsel *evsel __maybe_unused,
46 struct target *target __maybe_unused)
51 static inline int bpf_counter__enable(struct evsel *evsel __maybe_unused)
56 static inline int bpf_counter__disable(struct evsel *evsel __maybe_unused)
61 static inline int bpf_counter__read(struct evsel *evsel __maybe_unused)
66 static inline void bpf_counter__destroy(struct evsel *evsel __maybe_unused)
70 static inline int bpf_counter__install_pe(struct evsel *evsel __maybe_unused,
71 int cpu __maybe_unused,
72 int fd __maybe_unused)
77 #endif /* HAVE_BPF_SKEL */
79 #endif /* __PERF_BPF_COUNTER_H */