From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>
Cc: Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
netdev@vger.kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH bpf-next] bpf: test_bpf: Print total time of test in the summary
Date: Sat, 21 Aug 2021 20:13:59 +0800 [thread overview]
Message-ID: <1629548039-3747-1-git-send-email-yangtiezhu@loongson.cn> (raw)
The total time of test is useful to compare the performance
when bpf_jit_enable is 0 or 1, so print it in the summary.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
lib/test_bpf.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 830a18e..b1b17ba 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -8920,6 +8920,9 @@ static __init int test_skb_segment_single(const struct skb_segment_test *test)
static __init int test_skb_segment(void)
{
int i, err_cnt = 0, pass_cnt = 0;
+ u64 start, finish;
+
+ start = ktime_get_ns();
for (i = 0; i < ARRAY_SIZE(skb_segment_tests); i++) {
const struct skb_segment_test *test = &skb_segment_tests[i];
@@ -8935,8 +8938,10 @@ static __init int test_skb_segment(void)
}
}
- pr_info("%s: Summary: %d PASSED, %d FAILED\n", __func__,
- pass_cnt, err_cnt);
+ finish = ktime_get_ns();
+
+ pr_info("%s: Summary: %d PASSED, %d FAILED in %llu nsec\n",
+ __func__, pass_cnt, err_cnt, finish - start);
return err_cnt ? -EINVAL : 0;
}
@@ -8944,6 +8949,9 @@ static __init int test_bpf(void)
{
int i, err_cnt = 0, pass_cnt = 0;
int jit_cnt = 0, run_cnt = 0;
+ u64 start, finish;
+
+ start = ktime_get_ns();
for (i = 0; i < ARRAY_SIZE(tests); i++) {
struct bpf_prog *fp;
@@ -8983,8 +8991,10 @@ static __init int test_bpf(void)
}
}
- pr_info("Summary: %d PASSED, %d FAILED, [%d/%d JIT'ed]\n",
- pass_cnt, err_cnt, jit_cnt, run_cnt);
+ finish = ktime_get_ns();
+
+ pr_info("Summary: %d PASSED, %d FAILED, [%d/%d JIT'ed] in %llu nsec\n",
+ pass_cnt, err_cnt, jit_cnt, run_cnt, finish - start);
return err_cnt ? -EINVAL : 0;
}
@@ -9192,6 +9202,9 @@ static __init int test_tail_calls(struct bpf_array *progs)
{
int i, err_cnt = 0, pass_cnt = 0;
int jit_cnt = 0, run_cnt = 0;
+ u64 start, finish;
+
+ start = ktime_get_ns();
for (i = 0; i < ARRAY_SIZE(tail_call_tests); i++) {
struct tail_call_test *test = &tail_call_tests[i];
@@ -9222,8 +9235,10 @@ static __init int test_tail_calls(struct bpf_array *progs)
}
}
- pr_info("%s: Summary: %d PASSED, %d FAILED, [%d/%d JIT'ed]\n",
- __func__, pass_cnt, err_cnt, jit_cnt, run_cnt);
+ finish = ktime_get_ns();
+
+ pr_info("%s: Summary: %d PASSED, %d FAILED, [%d/%d JIT'ed] in %llu nsec\n",
+ __func__, pass_cnt, err_cnt, jit_cnt, run_cnt, finish - start);
return err_cnt ? -EINVAL : 0;
}
--
2.1.0
next reply other threads:[~2021-08-21 12:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-21 12:13 Tiezhu Yang [this message]
2021-08-23 15:48 ` [PATCH bpf-next] bpf: test_bpf: Print total time of test in the summary Daniel Borkmann
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=1629548039-3747-1-git-send-email-yangtiezhu@loongson.cn \
--to=yangtiezhu@loongson.cn \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).