• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
9 struct 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 
18 struct evsel;
19 
20 #ifdef HAVE_BPF_SKEL
21 struct 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);
24 int perf_bpf_filter__parse(struct list_head *expr_head, const char *str);
25 int perf_bpf_filter__prepare(struct evsel *evsel);
26 int perf_bpf_filter__destroy(struct evsel *evsel);
27 u64 perf_bpf_filter__lost_count(struct evsel *evsel);
28 
29 #else /* !HAVE_BPF_SKEL */
30 
perf_bpf_filter__parse(struct list_head * expr_head __maybe_unused,const char * str __maybe_unused)31 static inline int perf_bpf_filter__parse(struct list_head *expr_head __maybe_unused,
32 					 const char *str __maybe_unused)
33 {
34 	return -EOPNOTSUPP;
35 }
perf_bpf_filter__prepare(struct evsel * evsel __maybe_unused)36 static inline int perf_bpf_filter__prepare(struct evsel *evsel __maybe_unused)
37 {
38 	return -EOPNOTSUPP;
39 }
perf_bpf_filter__destroy(struct evsel * evsel __maybe_unused)40 static inline int perf_bpf_filter__destroy(struct evsel *evsel __maybe_unused)
41 {
42 	return -EOPNOTSUPP;
43 }
perf_bpf_filter__lost_count(struct evsel * evsel __maybe_unused)44 static 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