WIP FPC-III support
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / test_perf_buffer.c
blob8207a2dc2f9da03858ad8929097e0d6d9b0c478a
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
4 #include <linux/ptrace.h>
5 #include <linux/bpf.h>
6 #include <bpf/bpf_helpers.h>
7 #include <bpf/bpf_tracing.h>
9 struct {
10 __uint(type, BPF_MAP_TYPE_PERF_EVENT_ARRAY);
11 __uint(key_size, sizeof(int));
12 __uint(value_size, sizeof(int));
13 } perf_buf_map SEC(".maps");
15 SEC("tp/raw_syscalls/sys_enter")
16 int handle_sys_enter(void *ctx)
18 int cpu = bpf_get_smp_processor_id();
20 bpf_perf_event_output(ctx, &perf_buf_map, BPF_F_CURRENT_CPU,
21 &cpu, sizeof(cpu));
22 return 0;
25 char _license[] SEC("license") = "GPL";