Yonghong Song | 28dbf86 | 2018-04-28 22:28:13 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef __TRACE_HELPER_H |
| 3 | #define __TRACE_HELPER_H |
| 4 | |
Jakub Kicinski | d0cabbb | 2018-05-10 10:24:40 -0700 | [diff] [blame] | 5 | #include <libbpf.h> |
Toke Høiland-Jørgensen | 22adedd | 2018-06-25 14:25:02 +0200 | [diff] [blame] | 6 | #include <linux/perf_event.h> |
Jakub Kicinski | d0cabbb | 2018-05-10 10:24:40 -0700 | [diff] [blame] | 7 | |
Yonghong Song | 28dbf86 | 2018-04-28 22:28:13 -0700 | [diff] [blame] | 8 | struct ksym { |
| 9 | long addr; |
| 10 | char *name; |
| 11 | }; |
| 12 | |
| 13 | int load_kallsyms(void); |
| 14 | struct ksym *ksym_search(long key); |
Yonghong Song | 73bc4d9 | 2018-05-24 11:21:11 -0700 | [diff] [blame] | 15 | long ksym_get_addr(const char *name); |
Yonghong Song | 28dbf86 | 2018-04-28 22:28:13 -0700 | [diff] [blame] | 16 | |
Jakub Kicinski | d0cabbb | 2018-05-10 10:24:40 -0700 | [diff] [blame] | 17 | typedef enum bpf_perf_event_ret (*perf_event_print_fn)(void *data, int size); |
Yonghong Song | 28dbf86 | 2018-04-28 22:28:13 -0700 | [diff] [blame] | 18 | |
| 19 | int perf_event_mmap(int fd); |
Toke Høiland-Jørgensen | 22adedd | 2018-06-25 14:25:02 +0200 | [diff] [blame] | 20 | int perf_event_mmap_header(int fd, struct perf_event_mmap_page **header); |
Jakub Kicinski | d0cabbb | 2018-05-10 10:24:40 -0700 | [diff] [blame] | 21 | /* return LIBBPF_PERF_EVENT_DONE or LIBBPF_PERF_EVENT_ERROR */ |
Yonghong Song | 28dbf86 | 2018-04-28 22:28:13 -0700 | [diff] [blame] | 22 | int perf_event_poller(int fd, perf_event_print_fn output_fn); |
Toke Høiland-Jørgensen | 22adedd | 2018-06-25 14:25:02 +0200 | [diff] [blame] | 23 | int perf_event_poller_multi(int *fds, struct perf_event_mmap_page **headers, |
| 24 | int num_fds, perf_event_print_fn output_fn); |
Yonghong Song | 28dbf86 | 2018-04-28 22:28:13 -0700 | [diff] [blame] | 25 | #endif |