Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp373825pxb; Sat, 21 Aug 2021 05:16:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7XyFTgkVYsAWEKU78OmjqAzvz3YQOr/oUEar4/pd3FrWYHGW6+Lyy67yIyZ4tvWygD2xZ X-Received: by 2002:a05:6402:8ce:: with SMTP id d14mr27477989edz.228.1629548210427; Sat, 21 Aug 2021 05:16:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629548210; cv=none; d=google.com; s=arc-20160816; b=M6LgShnakomqlTYKbrKa3o/UMXj7UhEjUKhCldAsTd5JsxlrFDqB1FVRJn+Qke1VzM Z+LjWnraR0PhYTVTqjLyAbsidS2Ehp2y036XuMnZJZuVW0FufRznRC1chSWDYiyqj2so CtuFVIqTTMu9r5Q0zNOFzfUg+h5N0KNTU3v6TfP4Qp5wkN/q3iWXK5VyLmQ7nFVLmeQv NlUIi1TaWNlXb/nayRyt9OOEUzCmB9LvxGvDxlP2CO/Foe1bHf+b4jx2WoTgwok5mqct P1NDXUMW7fjluGS0ykRVZaZZMRxp5Ey+k/GmHLZldJ8ebosGPK9vs4bginLd1HIQva/D /lag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=L2m2NdxGRLTjtQIQVZBVhiFQ53KeDRGmF3aKwcHrlwI=; b=lWcYUTQq/mAWj/tGNckP0xzv7SSBpAvTI0uSvkCTF69QtNjtAqol0ckAF7nnt0loCj 141qZ0QvlVuiI07VNiuiiRGW+m8imDIAwV/tE7HAFKZ7HeJd+Xdp0Z+xfGh/g5unjh/B 8cNINeq2CnWUQ3GwgFYvLEq37RfY46WgqoAVmK8s5+J9U470n828Uqd0PuDY7NysJKpp 1fjDkUSMkAvZ8sQaE1qwP3M/RFsEjCUG2gRn131KLAqjqii0HMPZtf153x5asoIe2X+v B3mN6riAqJEN3Jc+dhGxKLqtlRyitN85M+LN3UR8C9o7j050EusIAJOJa8gXBJKPZTQ8 MpDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id di8si11340644ejc.542.2021.08.21.05.16.25; Sat, 21 Aug 2021 05:16:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234495AbhHUMOy (ORCPT + 99 others); Sat, 21 Aug 2021 08:14:54 -0400 Received: from mail.loongson.cn ([114.242.206.163]:53002 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234466AbhHUMOx (ORCPT ); Sat, 21 Aug 2021 08:14:53 -0400 Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9Dx30EH7iBhLFozAA--.19387S2; Sat, 21 Aug 2021 20:14:00 +0800 (CST) From: Tiezhu Yang To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , 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 Message-Id: <1629548039-3747-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf9Dx30EH7iBhLFozAA--.19387S2 X-Coremail-Antispam: 1UD129KBjvJXoW7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3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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