[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4226eb32-7755-5a32-5c58-7e64c129727c@iogearbox.net>
Date: Mon, 23 Aug 2021 17:48:00 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>,
Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>
Cc: Martin KaFai Lau <kafai@...com>, Song Liu <songliubraving@...com>,
Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, netdev@...r.kernel.org,
bpf@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next] bpf: test_bpf: Print total time of test in the
summary
On 8/21/21 2:13 PM, Tiezhu Yang wrote:
> 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@...ngson.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;
> }
I don't think this gives you any accurate results (e.g. what if this gets migrated
or preempted?); maybe rather use the duration from __run_one() ..
Thanks,
Daniel
Powered by blists - more mailing lists