diff --git a/observation/src/loads/loads.bpf.c b/observation/src/loads/loads.bpf.c new file mode 100644 index 0000000000000000000000000000000000000000..ce516f70b101f85e72c015870eb9d92f94cff6e8 --- /dev/null +++ b/observation/src/loads/loads.bpf.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) +#include "vmlinux.h" +#include +#include +#include + +const volatile __u64 avenrun_kaddr = 0; + +__u64 loads[3] = {}; + +SEC("perf_event") +int do_sample(struct bpf_perf_event_data *ctx) +{ + u64 *avenrun_kaddrp = (u64 *)avenrun_kaddr; + + if (avenrun_kaddr) + bpf_core_read(&loads, sizeof(loads), avenrun_kaddrp); + + return 0; +} + +char LICENSE[] SEC("license") = "GPL"; \ No newline at end of file