mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
selftests/bpf: Add kprobe multi triggering benchmarks
Adding kprobe multi triggering benchmarks. It's useful now to bench new fprobe implementation and might be useful later as well. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20240311211023.590321-1-jolsa@kernel.org
This commit is contained in:
parent
08701e306e
commit
379b97bbf0
3 changed files with 50 additions and 0 deletions
|
@ -496,6 +496,8 @@ extern const struct bench bench_trig_tp;
|
|||
extern const struct bench bench_trig_rawtp;
|
||||
extern const struct bench bench_trig_kprobe;
|
||||
extern const struct bench bench_trig_kretprobe;
|
||||
extern const struct bench bench_trig_kprobe_multi;
|
||||
extern const struct bench bench_trig_kretprobe_multi;
|
||||
extern const struct bench bench_trig_fentry;
|
||||
extern const struct bench bench_trig_fexit;
|
||||
extern const struct bench bench_trig_fentry_sleep;
|
||||
|
@ -542,6 +544,8 @@ static const struct bench *benchs[] = {
|
|||
&bench_trig_rawtp,
|
||||
&bench_trig_kprobe,
|
||||
&bench_trig_kretprobe,
|
||||
&bench_trig_kprobe_multi,
|
||||
&bench_trig_kretprobe_multi,
|
||||
&bench_trig_fentry,
|
||||
&bench_trig_fexit,
|
||||
&bench_trig_fentry_sleep,
|
||||
|
|
|
@ -91,6 +91,18 @@ static void trigger_kretprobe_setup(void)
|
|||
attach_bpf(ctx.skel->progs.bench_trigger_kretprobe);
|
||||
}
|
||||
|
||||
static void trigger_kprobe_multi_setup(void)
|
||||
{
|
||||
setup_ctx();
|
||||
attach_bpf(ctx.skel->progs.bench_trigger_kprobe_multi);
|
||||
}
|
||||
|
||||
static void trigger_kretprobe_multi_setup(void)
|
||||
{
|
||||
setup_ctx();
|
||||
attach_bpf(ctx.skel->progs.bench_trigger_kretprobe_multi);
|
||||
}
|
||||
|
||||
static void trigger_fentry_setup(void)
|
||||
{
|
||||
setup_ctx();
|
||||
|
@ -283,6 +295,26 @@ const struct bench bench_trig_kretprobe = {
|
|||
.report_final = hits_drops_report_final,
|
||||
};
|
||||
|
||||
const struct bench bench_trig_kprobe_multi = {
|
||||
.name = "trig-kprobe-multi",
|
||||
.validate = trigger_validate,
|
||||
.setup = trigger_kprobe_multi_setup,
|
||||
.producer_thread = trigger_producer,
|
||||
.measure = trigger_measure,
|
||||
.report_progress = hits_drops_report_progress,
|
||||
.report_final = hits_drops_report_final,
|
||||
};
|
||||
|
||||
const struct bench bench_trig_kretprobe_multi = {
|
||||
.name = "trig-kretprobe-multi",
|
||||
.validate = trigger_validate,
|
||||
.setup = trigger_kretprobe_multi_setup,
|
||||
.producer_thread = trigger_producer,
|
||||
.measure = trigger_measure,
|
||||
.report_progress = hits_drops_report_progress,
|
||||
.report_final = hits_drops_report_final,
|
||||
};
|
||||
|
||||
const struct bench bench_trig_fentry = {
|
||||
.name = "trig-fentry",
|
||||
.validate = trigger_validate,
|
||||
|
|
|
@ -40,6 +40,20 @@ int bench_trigger_kretprobe(void *ctx)
|
|||
return 0;
|
||||
}
|
||||
|
||||
SEC("kprobe.multi/" SYS_PREFIX "sys_getpgid")
|
||||
int bench_trigger_kprobe_multi(void *ctx)
|
||||
{
|
||||
__sync_add_and_fetch(&hits, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SEC("kretprobe.multi/" SYS_PREFIX "sys_getpgid")
|
||||
int bench_trigger_kretprobe_multi(void *ctx)
|
||||
{
|
||||
__sync_add_and_fetch(&hits, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SEC("fentry/" SYS_PREFIX "sys_getpgid")
|
||||
int bench_trigger_fentry(void *ctx)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue