Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf augmented_syscalls: Convert to bpf_map()

To make the code more compact, end result is the same:

# perf trace -e /home/acme/git/perf/tools/perf/examples/bpf/augmented_syscalls.c sleep 1
0.000 ( 0.008 ms): sleep/9663 openat(dfd: CWD, filename: "/etc/ld.so.cache", flags: RDONLY|CLOEXEC) = 3
0.022 ( 0.005 ms): sleep/9663 openat(dfd: CWD, filename: "/lib64/libc.so.6", flags: RDONLY|CLOEXEC) = 3
0.226 ( 0.006 ms): sleep/9663 openat(dfd: CWD, filename: "/usr/lib/locale/locale-archive", flags: RDONLY|CLOEXEC) = 3
#

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-23z08bgizqnbc3qdsyl7jyyg@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+2 -6
+2 -6
tools/perf/examples/bpf/augmented_syscalls.c
··· 19 19 #include <stdio.h> 20 20 #include <linux/socket.h> 21 21 22 - struct bpf_map SEC("maps") __augmented_syscalls__ = { 23 - .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY, 24 - .key_size = sizeof(int), 25 - .value_size = sizeof(u32), 26 - .max_entries = __NR_CPUS__, 27 - }; 22 + /* bpf-output associated map */ 23 + bpf_map(__augmented_syscalls__, PERF_EVENT_ARRAY, int, u32, __NR_CPUS__); 28 24 29 25 struct syscall_exit_args { 30 26 unsigned long long common_tp_fields;