1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2020 Facebook
6 #include <bpf/bpf_helpers.h>
9 char _license[] SEC("license") = "GPL";
12 __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
13 __uint(value_size, sizeof(int));
14 __uint(key_size, sizeof(int));
15 } perfbuf SEC(".maps");
17 const volatile int batch_cnt = 0;
20 long dropped __attribute__((aligned(128))) = 0;
22 SEC("fentry/" SYS_PREFIX "sys_getpgid")
23 int bench_perfbuf(void *ctx)
27 for (i = 0; i < batch_cnt; i++) {
28 if (bpf_perf_event_output(ctx, &perfbuf, BPF_F_CURRENT_CPU,
29 &sample_val, sizeof(sample_val)))
30 __sync_add_and_fetch(&dropped, 1);