1
linux/tools/perf/util/bpf_skel/bench_uprobe.bpf.c
Ian Rogers 988052f4bf perf bench uprobe: Add uretprobe variant of uprobe benchmarks
Name benchmarks with _ret at the end to avoid creating a new set of
benchmarks.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andrei Vagin <avagin@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Kees Kook <keescook@chromium.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20240406040911.1603801-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2024-04-12 17:54:02 -03:00

40 lines
676 B
C

// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
// Copyright (c) 2023 Red Hat
#include "vmlinux.h"
#include <bpf/bpf_tracing.h>
unsigned int nr_uprobes;
unsigned int nr_uretprobes;
SEC("uprobe")
int BPF_UPROBE(empty)
{
return 0;
}
SEC("uprobe")
int BPF_UPROBE(trace_printk)
{
char fmt[] = "perf bench uprobe %u";
bpf_trace_printk(fmt, sizeof(fmt), ++nr_uprobes);
return 0;
}
SEC("uretprobe")
int BPF_URETPROBE(empty_ret)
{
return 0;
}
SEC("uretprobe")
int BPF_URETPROBE(trace_printk_ret)
{
char fmt[] = "perf bench uretprobe %u";
bpf_trace_printk(fmt, sizeof(fmt), ++nr_uretprobes);
return 0;
}
char LICENSE[] SEC("license") = "Dual BSD/GPL";