1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2019 Facebook
4 #include <linux/ptrace.h>
6 #include <bpf/bpf_helpers.h>
7 #include "bpf_trace_helpers.h"
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("kprobe/sys_nanosleep")
16 int BPF_KPROBE(handle_sys_nanosleep_entry
)
18 int cpu
= bpf_get_smp_processor_id();
20 bpf_perf_event_output(ctx
, &perf_buf_map
, BPF_F_CURRENT_CPU
,
25 char _license
[] SEC("license") = "GPL";