From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by sourceware.org (Postfix) with ESMTPS id 3311F3858D20 for ; Fri, 3 Feb 2023 14:02:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3311F3858D20 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=amazon.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=amazon.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1675432977; x=1706968977; h=from:to:cc:date:message-id:references:in-reply-to: content-transfer-encoding:mime-version:subject; bh=u33zxFSCsMMpr2R3IRpcFZyhDFq8RS2BiKGVO6iwU8M=; b=JYKM8771SqeaePNBeMb9cUeXCnwAJ7ofj8DK5XkiwrYTgwQpvmIUoZ73 Lfdmn3gz/ENKgpuJD7XYb4/pd+mbZ5xInOQvF/8GexLb3zz8LDFOv5Zk/ z2V/jcnJA5yaqtu56M/8ZO5Et1+bm6JyOQ282rCh3O/tMIFvWSnOPiXr8 A=; X-IronPort-AV: E=Sophos;i="5.97,270,1669075200"; d="scan'208";a="293246384" Subject: RE: patch for hp-timing.h Thread-Topic: patch for hp-timing.h Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-pdx-2c-m6i4x-e7094f15.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2023 14:02:56 +0000 Received: from EX13MTAUWA001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-pdx-2c-m6i4x-e7094f15.us-west-2.amazon.com (Postfix) with ESMTPS id 2828141FC7; Fri, 3 Feb 2023 14:02:55 +0000 (UTC) Received: from EX19D044UWA001.ant.amazon.com (10.13.139.100) by EX13MTAUWA001.ant.amazon.com (10.43.160.58) with Microsoft SMTP Server (TLS) id 15.0.1497.45; Fri, 3 Feb 2023 14:02:55 +0000 Received: from EX19D044UWA004.ant.amazon.com (10.13.139.7) by EX19D044UWA001.ant.amazon.com (10.13.139.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.24; Fri, 3 Feb 2023 14:02:54 +0000 Received: from EX19D044UWA004.ant.amazon.com ([fe80::781f:7190:c095:c260]) by EX19D044UWA004.ant.amazon.com ([fe80::781f:7190:c095:c260%5]) with mapi id 15.02.1118.024; Fri, 3 Feb 2023 14:02:54 +0000 From: "Tang, Jun" To: Wilco Dijkstra CC: 'GNU C Library' Thread-Index: AQHZN9IvAXQnMYXJZEuLk2moftMhwK69Pqqw Date: Fri, 3 Feb 2023 14:02:54 +0000 Message-ID: <9bbf8ab63de540ddbdec4d7dc8e443a2@amazon.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.13.138.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Status: No, score=-18.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,USER_IN_DEF_SPF_WL 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: Wilco, Removing zero bits from multiply and making shifts afterwards can extend th= e time before overflow. Does it also reduce the resolution of the timer? Regards, Jun -----Original Message----- From: Wilco Dijkstra =20 Sent: Friday, February 3, 2023 7:30 AM To: Tang, Jun Cc: 'GNU C Library' Subject: [EXTERNAL] patch for hp-timing.h CAUTION: This email originated from outside of the organization. Do not cli= ck links or open attachments unless you can confirm the sender and know the= content is safe. Hi Jun, > hp-timing is only used on benchtest today, but it can be used on other=20 > 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 mul= tiply. Otherwise I'd suggest the floating point version since it's not like= the benchtests don't already use floating point. Cheers, Wilco diff --git a/benchtests/Makefile b/benchtests/Makefile index 292976b26b..a6= 24614207 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 inde= x 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" : "=3Dr" (freq)); \ - (Diff) =3D ((End) - (Start)) * (UINT64_C(1000000000) / freq); \ + (Diff) =3D (((End) - (Start)) * UINT64_C(1000000000)) / freq; \ }) #endif /* hp-timing.h */