1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef PERF_UTIL_BPF_FILTER_H
3 #define PERF_UTIL_BPF_FILTER_H
5 #include <linux/list.h>
7 #include "bpf_skel/sample-filter.h"
9 struct perf_bpf_filter_expr
{
10 struct list_head list
;
11 struct list_head groups
;
12 enum perf_bpf_filter_op op
;
14 enum perf_bpf_filter_term term
;
21 /* path in BPF-fs for the pinned program and maps */
22 #define PERF_BPF_FILTER_PIN_PATH "perf_filter"
25 struct perf_bpf_filter_expr
*perf_bpf_filter_expr__new(enum perf_bpf_filter_term term
,
27 enum perf_bpf_filter_op op
,
29 int perf_bpf_filter__parse(struct list_head
*expr_head
, const char *str
);
30 int perf_bpf_filter__prepare(struct evsel
*evsel
, struct target
*target
);
31 int perf_bpf_filter__destroy(struct evsel
*evsel
);
32 u64
perf_bpf_filter__lost_count(struct evsel
*evsel
);
33 int perf_bpf_filter__pin(void);
34 int perf_bpf_filter__unpin(void);
36 #else /* !HAVE_BPF_SKEL */
38 static inline int perf_bpf_filter__parse(struct list_head
*expr_head __maybe_unused
,
39 const char *str __maybe_unused
)
43 static inline int perf_bpf_filter__prepare(struct evsel
*evsel __maybe_unused
,
44 struct target
*target __maybe_unused
)
48 static inline int perf_bpf_filter__destroy(struct evsel
*evsel __maybe_unused
)
52 static inline u64
perf_bpf_filter__lost_count(struct evsel
*evsel __maybe_unused
)
56 static inline int perf_bpf_filter__pin(void)
60 static inline int perf_bpf_filter__unpin(void)
64 #endif /* HAVE_BPF_SKEL*/
65 #endif /* PERF_UTIL_BPF_FILTER_H */