diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2018-05-04 03:37:16 +0200 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-05-04 23:41:04 +0200 |
commit | f412eed9dfdeeb6becd7de2ffe8b5d0a8b3f81ca (patch) | |
tree | c6cf7b305e343a73505d5d1d25ee300a46992147 /tools/bpf/bpftool/main.h | |
parent | tools: bpftool: move get_possible_cpus() to common code (diff) | |
download | linux-f412eed9dfdeeb6becd7de2ffe8b5d0a8b3f81ca.tar.xz linux-f412eed9dfdeeb6becd7de2ffe8b5d0a8b3f81ca.zip |
tools: bpftool: add simple perf event output reader
Users of BPF sooner or later discover perf_event_output() helpers
and BPF_MAP_TYPE_PERF_EVENT_ARRAY. Dumping this array type is
not possible, however, we can add simple reading of perf events.
Create a new event_pipe subcommand for maps, this sub command
will only work with BPF_MAP_TYPE_PERF_EVENT_ARRAY maps.
Parts of the code from samples/bpf/trace_output_user.c.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/bpf/bpftool/main.h')
-rw-r--r-- | tools/bpf/bpftool/main.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h index cbf8985da362..6173cd997e7a 100644 --- a/tools/bpf/bpftool/main.h +++ b/tools/bpf/bpftool/main.h @@ -117,14 +117,18 @@ int do_pin_fd(int fd, const char *name); int do_prog(int argc, char **arg); int do_map(int argc, char **arg); +int do_event_pipe(int argc, char **argv); int do_cgroup(int argc, char **arg); int prog_parse_fd(int *argc, char ***argv); +int map_parse_fd_and_info(int *argc, char ***argv, void *info, __u32 *info_len); void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes, const char *arch); +void print_data_json(uint8_t *data, size_t len); void print_hex_data_json(uint8_t *data, size_t len); +unsigned int get_page_size(void); unsigned int get_possible_cpus(void); const char *ifindex_to_bfd_name_ns(__u32 ifindex, __u64 ns_dev, __u64 ns_ino); |