1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef PERF_UTIL_BPF_FILTER_H
3#define PERF_UTIL_BPF_FILTER_H
4
5#include <linux/list.h>
6
7#include "bpf_skel/sample-filter.h"
8
9struct perf_bpf_filter_expr {
10 struct list_head list;
11 struct list_head groups;
12 enum perf_bpf_filter_op op;
13 int part;
14 unsigned long sample_flags;
15 unsigned long val;
16};
17
18struct evsel;
19
20#ifdef HAVE_BPF_SKEL
21struct perf_bpf_filter_expr *perf_bpf_filter_expr__new(unsigned long sample_flags, int part,
22 enum perf_bpf_filter_op op,
23 unsigned long val);
24int perf_bpf_filter__parse(struct list_head *expr_head, const char *str);
25int perf_bpf_filter__prepare(struct evsel *evsel);
26int perf_bpf_filter__destroy(struct evsel *evsel);
27u64 perf_bpf_filter__lost_count(struct evsel *evsel);
28
29#else /* !HAVE_BPF_SKEL */
30
31static inline int perf_bpf_filter__parse(struct list_head *expr_head __maybe_unused,
32 const char *str __maybe_unused)
33{
34 return -EOPNOTSUPP;
35}
36static inline int perf_bpf_filter__prepare(struct evsel *evsel __maybe_unused)
37{
38 return -EOPNOTSUPP;
39}
40static inline int perf_bpf_filter__destroy(struct evsel *evsel __maybe_unused)
41{
42 return -EOPNOTSUPP;
43}
44static inline u64 perf_bpf_filter__lost_count(struct evsel *evsel __maybe_unused)
45{
46 return 0;
47}
48#endif /* HAVE_BPF_SKEL*/
49#endif /* PERF_UTIL_BPF_FILTER_H */
50

source code of linux/tools/perf/util/bpf-filter.h