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 1oLCRq-0004Bm-Sw for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Aug 2022 23:46:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oLCRp-00018I-BR for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Aug 2022 23:46:13 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLCRp-000189-0x for pgsql-hackers@lists.postgresql.org; Mon, 08 Aug 2022 23:46:13 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oLCRh-0005t6-1I for pgsql-hackers@postgresql.org; Mon, 08 Aug 2022 23:46:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 278Nk0AS747621; Mon, 8 Aug 2022 19:46:00 -0400 From: Tom Lane To: Thomas Munro cc: Andres Freund , Andrew Dunstan , Robert Haas , pgsql-hackers Subject: Re: Cleaning up historical portability baggage In-reply-to: References: <20220712173352.trdeq66asbv6vf2q@awork3.anarazel.de> <1662559.1657648462@sss.pgh.pa.us> <1249825.1658622186@sss.pgh.pa.us> <20220804034343.unm4rdynedbigamv@awork3.anarazel.de> <3322724.1659586159@sss.pgh.pa.us> <295419.1659918447@sss.pgh.pa.us> Comments: In-reply-to Thomas Munro message dated "Tue, 09 Aug 2022 11:35:05 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <747619.1660002360.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 08 Aug 2022 19:46:00 -0400 Message-ID: <747620.1660002360@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Thomas Munro writes: > Yeah, that's not true anymore, and QueryPerformanceCounter() is faster > than Get=C2=ADSystem=C2=ADTime=C2=ADPrecise=C2=ADAs=C2=ADFile=C2=ADTime(= )[1], but there doesn't > really seem to be any point in mentioning that or gettimeofday() at > all here. I propose to cut it down to just: > * This file provides an abstraction layer to hide portability issues i= n > - * interval timing. On Unix we use clock_gettime() if available, else > - * gettimeofday(). On Windows, gettimeofday() gives a low-precision re= sult > - * so we must use QueryPerformanceCounter() instead. These macros also= give > - * some breathing room to use other high-precision-timing APIs. > + * interval timing. On Unix we use clock_gettime(), and on Windows we = use > + * QueryPerformanceCounter(). These macros also give some breathing ro= om to > + * use other high-precision-timing APIs. WFM. > FWIW I expect this stuff to get whacked around some more for v16[2]. > [2] https://commitfest.postgresql.org/39/3751/ Meh. I think trying to use rdtsc is a fool's errand; you'll be fighting CPU quirks forever. regards, tom lane