Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cS8nw-0003vm-5m for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Jan 2017 20:50:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cS8nv-0005wc-NC for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Jan 2017 20:50:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cS8mV-0002jz-8F for pgsql-hackers@postgresql.org; Fri, 13 Jan 2017 20:49:03 +0000 Received: from albireo.enyo.de ([5.158.152.32]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1cS8mN-0007PE-Gk for pgsql-hackers@postgresql.org; Fri, 13 Jan 2017 20:49:02 +0000 Received: from [172.17.203.2] (helo=deneb.enyo.de) by albireo.enyo.de with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) id 1cS8mJ-0004FE-GH; Fri, 13 Jan 2017 21:48:51 +0100 Received: from fw by deneb.enyo.de with local (Exim 4.84_2) (envelope-from ) id 1cS8mJ-0002kO-BE; Fri, 13 Jan 2017 21:48:51 +0100 From: Florian Weimer To: Tom Lane Cc: Haribabu Kommi , PostgreSQL-development Subject: Re: gettimeofday is at the end of its usefulness? References: <31856.1400021891@sss.pgh.pa.us> <20140515185614.GG25053@momjian.us> <20237.1465397783@sss.pgh.pa.us> <15740.1482788055@sss.pgh.pa.us> <87y3yyfqqe.fsf@mid.deneb.enyo.de> <4130.1483045351@sss.pgh.pa.us> Date: Fri, 13 Jan 2017 21:48:51 +0100 In-Reply-To: <4130.1483045351@sss.pgh.pa.us> (Tom Lane's message of "Thu, 29 Dec 2016 16:02:31 -0500") Message-ID: <87wpdy1ya4.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain X-Pg-Spam-Score: -5.1 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org * Tom Lane: > Florian Weimer writes: >> * Tom Lane: >>> On Linux (RHEL6, 2.4GHz x86_64), I find that gettimeofday(), >>> clock_gettime(CLOCK_MONOTONIC), and clock_gettime(CLOCK_REALTIME) >>> all take about 40ns. Of course gettimeofday() only has 1us resolution, >>> but the other two have perhaps 10ns resolution (I get no duplicate >>> readings in a tight loop). > >> Isn't this very specific to kernel and glibc versions, depending on >> things like CONFIG_HZ settings and what level of vDSO support has been >> backported? > > No doubt, but I have yet to find a platform where clock_gettime() exists > but performs worse than gettimeofday(). Do you know of one? ppc64le with all the vDSO fixes for clock_gettime? glibc has some test cases which fail because clock_gettime gives inconsistent results. This has been fixed in current kernels, but I don't know if everyone uses them. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers