From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id 9B0993858D20 for ; Fri, 3 Feb 2023 13:38:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9B0993858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x22e.google.com with SMTP id o66so4145607oia.6 for ; Fri, 03 Feb 2023 05:38:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=KR+pg0i2vr163YZq5WbMRhED0pg2Xehvhombev9CsdQ=; b=nJLtuKtKI/1Yw23YSEJIjkWjs1F93fJSqQDCKDA16ku7yIOjwEqJ9ejSHwx+wqXcXz Pljjoo7bdjRHwnfAPujnyZfde6wLFDEig3PwAJlwqYF9leL1KORX+10L0mJPXOyjz5Z9 lMJtI1Lz8uG6l0HcoK2/a1gWhCf6TeSJfLsSyrxkt5Dw1DwE1zIkzKOViAVdW8j3abLe ObDTVihHXgFyM0KJ43UqufZ4P/ckhdAlPpUTtuVDLJjbY/2IGz0n8jn9GJESNSq/tlcF rjNwE2PnUKojCGiPK+9ibAgEixYgYbAXA+FaOaT3HoTKHwCUSFDwoZvzaGN+RJDHI3qf A8Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KR+pg0i2vr163YZq5WbMRhED0pg2Xehvhombev9CsdQ=; b=csBs8/WflDsOZzpCNQPob7VH2N7dpA3NKXefgeolcVi10tHdKKYGoLlSQSqEI3WiPD gqaq9ahSfZ9/QmS6Bd2sop7LbpHKseGqaI81N2UlBvHodBmvTZ8wBnuu0jy5g6FVZbn+ GWzNtR+QY5/6sFOcznyrNQFW5Ti3MggEQR2PWaLOHFX8L/f0DwMbe9C+TT9qwKJRR58v oxZcfM1XPrY9jO7eozQX3Z7EZFGcfQdQiUkRFEwTYSSbsjMe0ULAI5Eh6FUoiihSAEGt VpnBg2XWrjIn8cFDswI5xqc43CwTDGVqLu3xLa7r9dE//OyZ0aPRfboJvR51tIX9cC4k ek4g== X-Gm-Message-State: AO0yUKW5EF2nObCq+reE0dvuxHnJjP4uxHI1IUthR8x8/KZbNKj+8opd S9oh5U/bCFOGsY5iqBixJhv7NMLdXG0108AM0pY= X-Google-Smtp-Source: AK7set8KzaqAUkETiDe15LUF6auAt49bWqjdmZkbRhxmB6hFHcLQelgVqToOVLnCno4hykCbwGOnCw== X-Received: by 2002:a05:6808:15a4:b0:37a:db50:1908 with SMTP id t36-20020a05680815a400b0037adb501908mr2067940oiw.1.1675431507856; Fri, 03 Feb 2023 05:38:27 -0800 (PST) Received: from ?IPV6:2804:1b3:a7c2:1887:71e4:6a44:32a:be62? ([2804:1b3:a7c2:1887:71e4:6a44:32a:be62]) by smtp.gmail.com with ESMTPSA id dd6-20020a056808604600b00364e50e10c0sm781742oib.56.2023.02.03.05.38.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 Feb 2023 05:38:27 -0800 (PST) Message-ID: <7f31125b-87db-336a-e088-1d5ae6a22aa3@linaro.org> Date: Fri, 3 Feb 2023 10:38:24 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.7.0 Subject: Re: patch for hp-timing.h Content-Language: en-US To: Wilco Dijkstra , "Tang, Jun" Cc: 'GNU C Library' References: From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 03/02/23 10:29, Wilco Dijkstra via Libc-alpha wrote: > Hi Jun, > >> hp-timing is only used on benchtest today, but it can be used on other >> measurements in the future. > > It can't as proposed below since this would overflow in ~16 seconds. > We could improve this by removing the zero bits from the multiply > and doing some shifts, maybe that will make the interval long enough > for integer multiply. Otherwise I'd suggest the floating point version since > it's not like the benchtests don't already use floating point. > > Cheers, > Wilco Do we really need to handle more than ~16 seconds for the hp-timing? It is usually used along with a accumulator and I would expect that once you need to measure more than 16s using clock_gettime works as expected. > > diff --git a/benchtests/Makefile b/benchtests/Makefile > index 292976b26b..a624614207 100644 > --- a/benchtests/Makefile > +++ b/benchtests/Makefile > @@ -499,4 +499,5 @@ $(objpfx)bench-%.c: %-inputs $(bench-deps) > cat $($*-INCLUDE); \ > fi; \ > $(PYTHON) scripts/bench.py $(patsubst %-inputs,%,$<); } > $@-tmp > + cp -f $@-tmp $@-bak > > Unintended change I guess? > > mv -f $@-tmp $@ > diff --git a/sysdeps/aarch64/hp-timing.h b/sysdeps/aarch64/hp-timing.h > index f7f7ac7cae..c699effe6a 100644 > --- a/sysdeps/aarch64/hp-timing.h > +++ b/sysdeps/aarch64/hp-timing.h > @@ -41,7 +41,7 @@ typedef uint64_t hp_timing_t; > #define HP_TIMING_DIFF(Diff, Start, End) \ > ({ hp_timing_t freq; \ > __asm__ __volatile__ ("mrs %0, cntfrq_el0" : "=r" (freq)); \ > - (Diff) = ((End) - (Start)) * (UINT64_C(1000000000) / freq); \ > + (Diff) = (((End) - (Start)) * UINT64_C(1000000000)) / freq; \ > }) > > #endif /* hp-timing.h */