Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v6.18-rc6 75 lines 1.9 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef __PERF_BPF_COUNTER_H 3#define __PERF_BPF_COUNTER_H 1 4 5struct evsel; 6struct target; 7 8#ifdef HAVE_BPF_SKEL 9 10typedef int (*bpf_counter_evsel_op)(struct evsel *evsel); 11typedef int (*bpf_counter_evsel_target_op)(struct evsel *evsel, 12 struct target *target); 13typedef int (*bpf_counter_evsel_install_pe_op)(struct evsel *evsel, 14 int cpu_map_idx, 15 int fd); 16 17/* Shared ops between bpf_counter, bpf_counter_cgroup, etc. */ 18struct 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; 25}; 26 27int bpf_counter__load(struct evsel *evsel, struct target *target); 28int bpf_counter__enable(struct evsel *evsel); 29int bpf_counter__disable(struct evsel *evsel); 30int bpf_counter__read(struct evsel *evsel); 31void bpf_counter__destroy(struct evsel *evsel); 32int bpf_counter__install_pe(struct evsel *evsel, int cpu_map_idx, int fd); 33 34int bperf_trigger_reading(int prog_fd, int cpu); 35void set_max_rlimit(void); 36 37#else /* HAVE_BPF_SKEL */ 38 39#include <linux/err.h> 40 41static inline int bpf_counter__load(struct evsel *evsel __maybe_unused, 42 struct target *target __maybe_unused) 43{ 44 return 0; 45} 46 47static inline int bpf_counter__enable(struct evsel *evsel __maybe_unused) 48{ 49 return 0; 50} 51 52static inline int bpf_counter__disable(struct evsel *evsel __maybe_unused) 53{ 54 return 0; 55} 56 57static inline int bpf_counter__read(struct evsel *evsel __maybe_unused) 58{ 59 return -EAGAIN; 60} 61 62static inline void bpf_counter__destroy(struct evsel *evsel __maybe_unused) 63{ 64} 65 66static inline int bpf_counter__install_pe(struct evsel *evsel __maybe_unused, 67 int cpu __maybe_unused, 68 int fd __maybe_unused) 69{ 70 return 0; 71} 72 73#endif /* HAVE_BPF_SKEL */ 74 75#endif /* __PERF_BPF_COUNTER_H */