1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __TRACE_HELPER_H 3 #define __TRACE_HELPER_H 4 5 #include <libbpf.h> 6 #include <linux/perf_event.h> 7 8 struct ksym { 9 long addr; 10 char *name; 11 }; 12 13 int load_kallsyms(void); 14 struct ksym *ksym_search(long key); 15 long ksym_get_addr(const char *name); 16 17 typedef enum bpf_perf_event_ret (*perf_event_print_fn)(void *data, int size); 18 19 int perf_event_mmap(int fd); 20 int perf_event_mmap_header(int fd, struct perf_event_mmap_page **header); 21 /* return LIBBPF_PERF_EVENT_DONE or LIBBPF_PERF_EVENT_ERROR */ 22 int perf_event_poller(int fd, perf_event_print_fn output_fn); 23 int perf_event_poller_multi(int *fds, struct perf_event_mmap_page **headers, 24 int num_fds, perf_event_print_fn output_fn); 25 #endif 26