xref: /linux/tools/perf/util/bpf_skel/bench_uprobe.bpf.c (revision ad30469a841b50dbb541df4d6971d891f703c297)
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 
8 SEC("uprobe")
9 int BPF_UPROBE(empty)
10 {
11        return 0;
12 }
13 
14 SEC("uprobe")
15 int BPF_UPROBE(trace_printk)
16 {
17 	char fmt[] = "perf bench uprobe %u";
18 
19 	bpf_trace_printk(fmt, sizeof(fmt), ++nr_uprobes);
20 	return 0;
21 }
22 
23 char LICENSE[] SEC("license") = "Dual BSD/GPL";
24