0001
0002
0003
0004 #include "vmlinux.h"
0005 #include <bpf/bpf_helpers.h>
0006 #include <bpf/usdt.bpf.h>
0007
0008
0009
0010
0011
0012
0013 extern int my_pid;
0014
0015 int usdt_100_called;
0016 int usdt_100_sum;
0017
0018 SEC("usdt//proc/self/exe:test:usdt_100")
0019 int BPF_USDT(usdt_100, int x)
0020 {
0021 long tmp;
0022
0023 if (my_pid != (bpf_get_current_pid_tgid() >> 32))
0024 return 0;
0025
0026 __sync_fetch_and_add(&usdt_100_called, 1);
0027 __sync_fetch_and_add(&usdt_100_sum, x);
0028
0029 return 0;
0030 }
0031
0032 char _license[] SEC("license") = "GPL";