Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: "Daniel T. Lee" <danieltimlee@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Mykola Lysenko <mykolal@fb.com>,
	Shuah Khan <shuah@kernel.org>, Yipeng Zou <zouyipeng@huawei.com>,
	linux-kselftest@vger.kernel.org, bpf@vger.kernel.org,
	netdev@vger.kernel.org
Subject: [bpf-next 2/3] selftests/bpf: add rename tracepoint bench test
Date: Mon, 12 Aug 2024 00:45:02 +0000	[thread overview]
Message-ID: <20240812004503.43206-3-danieltimlee@gmail.com> (raw)
In-Reply-To: <20240812004503.43206-1-danieltimlee@gmail.com>

In addition to migrating the tracepoint overhead test from sample/bpf
to selftest/bpf, this commit extends benchmarking test with rename
task.

Since previous commit migrated tracepoint based on rename task, this
commit updates the benchmarking program to utilize the newly added
'rename-tp'.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
---
 tools/testing/selftests/bpf/bench.c              |  2 ++
 .../testing/selftests/bpf/benchs/bench_rename.c  | 16 ++++++++++++++++
 .../selftests/bpf/benchs/run_bench_rename.sh     |  2 +-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/bench.c b/tools/testing/selftests/bpf/bench.c
index 627b74ae041b..e3d17b9b78cc 100644
--- a/tools/testing/selftests/bpf/bench.c
+++ b/tools/testing/selftests/bpf/bench.c
@@ -495,6 +495,7 @@ extern const struct bench bench_rename_kretprobe;
 extern const struct bench bench_rename_rawtp;
 extern const struct bench bench_rename_fentry;
 extern const struct bench bench_rename_fexit;
+extern const struct bench bench_rename_tp;
 
 /* pure counting benchmarks to establish theoretical lmits */
 extern const struct bench bench_trig_usermode_count;
@@ -552,6 +553,7 @@ static const struct bench *benchs[] = {
 	&bench_rename_rawtp,
 	&bench_rename_fentry,
 	&bench_rename_fexit,
+	&bench_rename_tp,
 	/* pure counting benchmarks for establishing theoretical limits */
 	&bench_trig_usermode_count,
 	&bench_trig_kernel_count,
diff --git a/tools/testing/selftests/bpf/benchs/bench_rename.c b/tools/testing/selftests/bpf/benchs/bench_rename.c
index bf66893c7a33..48cd9556ddf8 100644
--- a/tools/testing/selftests/bpf/benchs/bench_rename.c
+++ b/tools/testing/selftests/bpf/benchs/bench_rename.c
@@ -106,6 +106,12 @@ static void setup_fexit(void)
 	attach_bpf(ctx.skel->progs.prog5);
 }
 
+static void setup_tp(void)
+{
+	setup_ctx();
+	attach_bpf(ctx.skel->progs.prog6);
+}
+
 const struct bench bench_rename_base = {
 	.name = "rename-base",
 	.validate = validate,
@@ -136,6 +142,16 @@ const struct bench bench_rename_kretprobe = {
 	.report_final = hits_drops_report_final,
 };
 
+const struct bench bench_rename_tp = {
+	.name = "rename-tp",
+	.validate = validate,
+	.setup = setup_tp,
+	.producer_thread = producer,
+	.measure = measure,
+	.report_progress = hits_drops_report_progress,
+	.report_final = hits_drops_report_final,
+};
+
 const struct bench bench_rename_rawtp = {
 	.name = "rename-rawtp",
 	.validate = validate,
diff --git a/tools/testing/selftests/bpf/benchs/run_bench_rename.sh b/tools/testing/selftests/bpf/benchs/run_bench_rename.sh
index 7b281dbe4165..131e5e6ea8ec 100755
--- a/tools/testing/selftests/bpf/benchs/run_bench_rename.sh
+++ b/tools/testing/selftests/bpf/benchs/run_bench_rename.sh
@@ -2,7 +2,7 @@
 
 set -eufo pipefail
 
-for i in base kprobe kretprobe rawtp fentry fexit
+for i in base kprobe kretprobe rawtp fentry fexit tp
 do
 	summary=$(sudo ./bench -w2 -d5 -a rename-$i | tail -n1 | cut -d'(' -f1 | cut -d' ' -f3-)
 	printf "%-10s: %s\n" $i "$summary"
-- 
2.43.0


  parent reply	other threads:[~2024-08-12  0:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12  0:45 [bpf-next 0/3] samples/bpf: Remove obsolete tracing-related tests Daniel T. Lee
2024-08-12  0:45 ` [bpf-next 1/3] selftests/bpf: migrate tracepoint overhead test to prog_tests Daniel T. Lee
2024-08-12 11:11   ` Jiri Olsa
2024-08-12  0:45 ` Daniel T. Lee [this message]
2024-08-12 11:12   ` [bpf-next 2/3] selftests/bpf: add rename tracepoint bench test Jiri Olsa
2024-08-12  0:45 ` [bpf-next 3/3] samples/bpf: remove obsolete tracing related tests Daniel T. Lee
2024-08-12 21:17 ` [bpf-next 0/3] samples/bpf: Remove obsolete tracing-related tests Andrii Nakryiko
2024-08-13 17:39   ` Daniel T. Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240812004503.43206-3-danieltimlee@gmail.com \
    --to=danieltimlee@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    --cc=zouyipeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox