Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1968272pxb; Mon, 23 Aug 2021 08:50:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9Sa4szm5qv0j4nd5ssc8vcQI3L5E7zp27vuY+O6msIycseoddwCHkyp6I83y2dUU3nYF/ X-Received: by 2002:a17:906:abc6:: with SMTP id kq6mr4248179ejb.317.1629733809846; Mon, 23 Aug 2021 08:50:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629733809; cv=none; d=google.com; s=arc-20160816; b=gspNvtFcwf+OD8G13zwgPXf+Fndip6r4f31k2ETX2mO0LoA0NmCi+zI29y3TH69vWz JNH04sJwAdL5oRHl++tPSEgigGvUiv+6A1I+8HiKVPER2u72V36tlxlsikkB1iifATJ0 4WzVojcZnquYfqYO3N8/UTMozOP+SrU4blgaiJnA4dMEUsgNmEl+sHndMWLv1qTycLav RWUdbYwHbJgYw28diBAazrB5ZYc004EXg+4OmXvHUlpl4DBPChCilmh/6rbrqwT5mW5L sGabZ+rZ0ZPzBVIhbRavXjrLssmE+lfcKPOkTqQCnhQn8sgr6RFwt4WgmObBwr9CIvMf I5AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=YMPPSfA2ExZxGWWXFmv1LoPsXMFzwunMYbtYM+uKylM=; b=vkEuVwQ6eLVowN42xCHYEQrTI2ofyXJ3kQt+UBg4OS3/CdEjGSM0sALEp0e6+b+yOi TbzyDIPmdtkIdiUP9+ioVgzmIyl2RpDC1J088g/6HkjNdnrOxw1PR7RdKbCRlSMj8g1J Hjl2ai71sPGHo9YdWCa1zylHwOQKk29DezDyI74Th3DaJzpD0CxlKlw2xoGZoqle3b46 +7n2/pG6wP56ba+WaAxr8BdNoWi6HGOrVxDnrOmk9w/r5cUPmElCKvl1mXF6rUTzq7c2 n59BPgoA6EXfBO7UKU9iri5UpwChtXHJzsaQJBRywybOzlqqpS6M0HG0bA/WkYH+CndT IV0w== 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 co10si14851971edb.200.2021.08.23.08.49.45; Mon, 23 Aug 2021 08:50:09 -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 S231272AbhHWPs4 (ORCPT + 99 others); Mon, 23 Aug 2021 11:48:56 -0400 Received: from www62.your-server.de ([213.133.104.62]:34654 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230314AbhHWPsz (ORCPT ); Mon, 23 Aug 2021 11:48:55 -0400 Received: from sslproxy02.your-server.de ([78.47.166.47]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1mICBA-0006tY-Ed; Mon, 23 Aug 2021 17:48:04 +0200 Received: from [85.5.47.65] (helo=linux.home) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mICB9-000Jg5-UB; Mon, 23 Aug 2021 17:48:04 +0200 Subject: Re: [PATCH bpf-next] bpf: test_bpf: Print total time of test in the summary To: Tiezhu Yang , Alexei Starovoitov , 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 References: <1629548039-3747-1-git-send-email-yangtiezhu@loongson.cn> From: Daniel Borkmann Message-ID: <4226eb32-7755-5a32-5c58-7e64c129727c@iogearbox.net> Date: Mon, 23 Aug 2021 17:48:00 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <1629548039-3747-1-git-send-email-yangtiezhu@loongson.cn> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.2/26272/Mon Aug 23 10:21:13 2021) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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