blob: 18924f23db1b99f30fbf198830868d98d7eb42b4 [file] [log] [blame]
Yonghong Song28dbf862018-04-28 22:28:13 -07001/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __TRACE_HELPER_H
3#define __TRACE_HELPER_H
4
Jakub Kicinskid0cabbb2018-05-10 10:24:40 -07005#include <libbpf.h>
Toke Høiland-Jørgensen22adedd2018-06-25 14:25:02 +02006#include <linux/perf_event.h>
Jakub Kicinskid0cabbb2018-05-10 10:24:40 -07007
Yonghong Song28dbf862018-04-28 22:28:13 -07008struct ksym {
9 long addr;
10 char *name;
11};
12
13int load_kallsyms(void);
14struct ksym *ksym_search(long key);
Yonghong Song73bc4d92018-05-24 11:21:11 -070015long ksym_get_addr(const char *name);
Yonghong Song28dbf862018-04-28 22:28:13 -070016
Jakub Kicinskid0cabbb2018-05-10 10:24:40 -070017typedef enum bpf_perf_event_ret (*perf_event_print_fn)(void *data, int size);
Yonghong Song28dbf862018-04-28 22:28:13 -070018
19int perf_event_mmap(int fd);
Toke Høiland-Jørgensen22adedd2018-06-25 14:25:02 +020020int perf_event_mmap_header(int fd, struct perf_event_mmap_page **header);
Jakub Kicinskid0cabbb2018-05-10 10:24:40 -070021/* return LIBBPF_PERF_EVENT_DONE or LIBBPF_PERF_EVENT_ERROR */
Yonghong Song28dbf862018-04-28 22:28:13 -070022int perf_event_poller(int fd, perf_event_print_fn output_fn);
Toke Høiland-Jørgensen22adedd2018-06-25 14:25:02 +020023int perf_event_poller_multi(int *fds, struct perf_event_mmap_page **headers,
24 int num_fds, perf_event_print_fn output_fn);
Yonghong Song28dbf862018-04-28 22:28:13 -070025#endif