• Arnaldo Carvalho de Melo's avatar
    perf trace: Allow dumping a BPF map after setting up BPF events · ff7a4f98
    Arnaldo Carvalho de Melo authored
    Initial use case:
    
    Dumping the maps setup by tools/perf/examples/bpf/augmented_raw_syscalls.c,
    which so far are just booleans, showing just non-zeroed entries:
    
      # cat ~/.perfconfig
      [llvm]
    	dump-obj = true
    	clang-opt = -g
      [trace]
    	#add_events = /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
    	add_events = /wb/augmented_raw_syscalls.o
      $ date
      Tue Feb 19 16:29:33 -03 2019
      $ ls -la /wb/augmented_raw_syscalls.o
      -rwxr-xr-x. 1 root root 14048 Jan 24 12:09 /wb/augmented_raw_syscalls.o
      $ file /wb/augmented_raw_syscalls.o
      /wb/augmented_raw_syscalls.o: ELF 64-bit LSB relocatable, eBPF, version 1 (SYSV), with debug_info, not stripped
      $
      # trace -e recvmmsg,sendmmsg --map-dump foobar
      ERROR: BPF map "foobar" not found
      # trace -e recvmmsg,sendmmsg --map-dump filtered_pids
      ERROR: BPF map "filtered_pids" not found
      # trace -e recvmmsg,sendmmsg --map-dump pids_filtered
      [2583] = 1,
      [2267] = 1,
      ^Z
      [1]+  Stopped                 trace -e recvmmsg,sendmmsg --map-dump pids_filtered
      # pidof trace
      2267
      # ps ax|grep gnome-terminal|grep -v grep
      2583 ?        Ssl   58:33 /usr/libexec/gnome-terminal-server
      ^C
      # trace -e recvmmsg,sendmmsg --map-dump syscalls
      [299] = 1,
      [307] = 1,
      ^C
      # grep x64_recvmmsg arch/x86/entry/syscalls/syscall_64.tbl
      299	64	recvmmsg		__x64_sys_recvmmsg
      # grep x64_sendmmsg arch/x86/entry/syscalls/syscall_64.tbl
      307	64	sendmmsg		__x64_sys_sendmmsg
      #
    
    Next step probably will be something like 'perf stat's --interval-print and
    --interval-clear.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Alexei Starovoitov <ast@kernel.org>
    Cc: Daniel Borkmann <daniel@iogearbox.net>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Martin KaFai Lau <kafai@fb.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Yonghong Song <yhs@fb.com>
    Link: https://lkml.kernel.org/n/tip-ztxj25rtx37ixo9cfajt8ocy@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    ff7a4f98
perf-trace.txt 12.5 KB