Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pJpHi-00043x-E1 for pgsql-committers@arkaria.postgresql.org; Mon, 23 Jan 2023 05:22:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pJpHh-0000zS-CS for pgsql-committers@arkaria.postgresql.org; Mon, 23 Jan 2023 05:22:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pJpHh-0000zJ-5V for pgsql-committers@lists.postgresql.org; Mon, 23 Jan 2023 05:22:21 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pJpHe-0004wi-MX for pgsql-committers@lists.postgresql.org; Mon, 23 Jan 2023 05:22:20 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 3391A5C0040; Mon, 23 Jan 2023 00:22:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 23 Jan 2023 00:22:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1674451337; x=1674537737; bh=ZQznVgiakj eOCkSvu2JuVZbZC0DiiJ49FqzjHf8+0W4=; b=BmesK93iN16tBipPNTgFlMDW+j 4ptejMo/a0Y9RQUn4rMU7wFkzEnjYu0VY1oUdOGsVgyApWJC0RHt1h0ynQuG3LNB ZYN8rViPi2mHVyz7+QgjLDodvCZ+SuF0PfKeMY1LruJmcNHUINyvaZM22qaOaNgn VY1oHG1Puqc3BE7tijV3DwivyLjsHPv3peiFTD8fKAgaiPf25yeYX0GsuzgjWY5Q VJ5Jh42KtOwaHJzTfUo3Uhvp7RdX1yAfDqHyyuzUEFhkFRLLQMWpUTn4JJ7U0S8J O5h+MXXnFzYGvKCuwhonO6LQ0pCYRiZuY8P3vS9sr/FCmJY9u6NkW/wo8CLQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1674451337; x=1674537737; bh=ZQznVgiakjeOCkSvu2JuVZbZC0Di iJ49FqzjHf8+0W4=; b=CNxthXEgd5ia4f8Fzq8kcVDL+QtLBenwN610pi0Q5PeD ipFeQwZ4E0hoyTLWa0MvN7OxlnwCnM4vvPTjJAl2EHDHd8o61ugKvHDxRG9OkTqK SVpeo8BhwS2WJtqZfK9ee1qKFaSiHlzOJHn+MOgCr2/Vr4NN4n/NVjM8/DgSWrrf gevQ6p6C+qBGH5T/EJU1R2RNRLrvpAulOE5NMhL7DFsJ0Z1z9sc1s7i8cmTd9o1m XHKgdCgFWnKFixpoyc3O/0ChDw54Q45cbhfeKRu55pWHA7eFZH5IXerRUiyZAunV uPTtsWMzuWnlUsq3PNrVuPJy8W5NuAEnzTa7qFC1iQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedruddujedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdludejmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepgeffjeevgfevuddvjedtvddt ieejheduueelvddufedtgfefjedvkeevkeeivddvnecuffhomhgrihhnpehpohhsthhgrh gvshhqlhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhl fhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 23 Jan 2023 00:22:15 -0500 (EST) Date: Mon, 23 Jan 2023 14:22:06 +0900 From: Michael Paquier To: Andres Freund Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: instr_time: Represent time as an int64 on all platforms Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IiYvSajTCrJ+pNvt" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --IiYvSajTCrJ+pNvt Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Andres, On Sat, Jan 21, 2023 at 05:25:19AM +0000, Andres Freund wrote: > instr_time: Represent time as an int64 on all platforms >=20 > Until now we used struct timespec for instr_time on all platforms but > windows. Using struct timespec causes a fair bit of memory (struct timeva= l is > 16 bytes) and runtime overhead (much more complicated additions). Instead= we > can convert the time to nanoseconds in INSTR_TIME_SET_CURRENT(), making t= he > remaining operations cheaper. >=20 > Representing time as int64 nanoseconds provides sufficient range, ~292 ye= ars > relative to a starting point (depending on clock source, relative to the = unix > epoch or the system's boot time). That'd not be sufficient for calendar t= ime > stored on disk, but is plenty for runtime interval time measurement. >=20 > On windows instr_time already is represented as cycles. It might make sen= se to > represent time as cycles on other platforms as well, as using cycle > acquisition instructions like rdtsc directly can reduce the overhead of t= ime > acquisition substantially. This could be done in a fairly localized manne= r as > the code stands after this commit. >=20 > Because the windows and non-windows paths are now more similar, use a com= mon > set of macros. To make that possible, most of the use of LARGE_INTEGER ha= d to > be removed, which looks nicer anyway. >=20 > To avoid users of the API relying on the integer representation, we wrap = the > 64bit integer inside struct struct instr_time. >=20 > Author: Andres Freund > Author: Lukas Fittl hoverfly is unhappy since this went in: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dhoverfly&dt=3D202= 3-01-23%2005%3A01%3A44 "../../../src/include/portability/instr_time.h", line 116.9: 1506-304 (I) N= o function prototype given for "clock_gettime". "../../../src/include/portability/instr_time.h", line 116.23: 1506-045 (S) = Undeclared identifier CLOCK_REALTIME. : recipe for target 'plpy_cursorobject.o' failed Thanks, -- Michael --IiYvSajTCrJ+pNvt Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmPOGX4ACgkQnvQgOdby QH1AhhAAo8t6FBGlZ1KY+5cNKzNhfrcieY2b5NawCfjBwyTv6GR08MnXcLsDVUBR RP8ttwwhaALyfu0AMPA53WOXWJJCwAizagRsZ8JtVM1Iyo4pjNNMNNcZywcZR1+l Y/colB6SP0m9cwIiRbDDNRxQNZUG92L4UF1E/JZYKzbvhpEsHD/39qEu9t9UGFbD rNdCk3zrmHCcqUE815G3GFAuLa6zaYz+JBGnZ0eZwpbtwm82tx9lUoyL0yNWSKNP aHCISS1n9biQ884VRLKWDu1rLSd3SQC/deqAzyl6BNUu/Ze8aERvjEucBY7dOFIE f9oOK6fl4f3m6JhCtH7uPnYFWLpib2GMqLGO8DQI2FzLIbL758JI9pq38S2geub5 InxeS6Hl8klwxtQDZsIoI+9m9FK9rFdCaQQ5Mtp93vmmZPPIXzEY8G84l0XovF9r V8LpUbbfgHThGxb+9j3qqHD8Blhe4BFzkN/cJpR36CYNbxuKF4w5Wk8b5rSKfye3 t9l4imZ9AbBE6IMt2hwQPkAbkJiW0I2ue5eTs2KFqj83oN+6SYkbBGvFSHp5kdhb AdQmmRvDCib3mLQ70Nz4cw+mPLmtI2Xd+b9GtWtfoDFfRr8UeelPPbvyLAC1Mvtw B7JlWoyQmfrKlpYsxUgTyzShRMOb7pogLxXvkS7+iaVl0tAfRmA= =aqIe -----END PGP SIGNATURE----- --IiYvSajTCrJ+pNvt--