1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 // Copyright (c) 2023 Red Hat 3 #include "vmlinux.h" 4 #include <bpf/bpf_tracing.h> 5 6 unsigned int nr_uprobes; 7 unsigned int nr_uretprobes; 8 9 SEC("uprobe") 10 int BPF_UPROBE(empty) 11 { 12 return 0; 13 } 14 15 SEC("uprobe") 16 int BPF_UPROBE(trace_printk) 17 { 18 char fmt[] = "perf bench uprobe %u"; 19 20 bpf_trace_printk(fmt, sizeof(fmt), ++nr_uprobes); 21 return 0; 22 } 23 24 SEC("uretprobe") 25 int BPF_URETPROBE(empty_ret) 26 { 27 return 0; 28 } 29 30 SEC("uretprobe") 31 int BPF_URETPROBE(trace_printk_ret) 32 { 33 char fmt[] = "perf bench uretprobe %u"; 34 35 bpf_trace_printk(fmt, sizeof(fmt), ++nr_uretprobes); 36 return 0; 37 } 38 39 char LICENSE[] SEC("license") = "Dual BSD/GPL"; 40