Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cMi65-00013T-4Y for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Dec 2016 21:18:49 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cMi64-0000b9-J3 for pgsql-hackers@arkaria.postgresql.org; Thu, 29 Dec 2016 21:18:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cMi63-0000Z4-JX for pgsql-hackers@postgresql.org; Thu, 29 Dec 2016 21:18:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cMi60-0004IH-QO for pgsql-hackers@postgresql.org; Thu, 29 Dec 2016 21:18:46 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id uBTLIgIx004686; Thu, 29 Dec 2016 16:18:42 -0500 From: Tom Lane To: Thomas Munro cc: Haribabu Kommi , PostgreSQL-development Subject: Re: gettimeofday is at the end of its usefulness? In-reply-to: References: <31856.1400021891@sss.pgh.pa.us> <20140515185614.GG25053@momjian.us> <20237.1465397783@sss.pgh.pa.us> <15740.1482788055@sss.pgh.pa.us> Comments: In-reply-to Thomas Munro message dated "Fri, 30 Dec 2016 10:05:39 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4684.1483046322.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 29 Dec 2016 16:18:42 -0500 Message-ID: <4685.1483046322@sss.pgh.pa.us> 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 Thomas Munro writes: > On Tue, Dec 27, 2016 at 10:34 AM, Tom Lane wrote: >> However, it seems that these impressive results date back only to >> June 2012, cf >> https://github.com/freebsd/freebsd/commit/13a9f42818f6b89a72b3e40923be80= 9b490400d8 >> and at least as of that commit, only x86 and x86_64 had the fast >> clock_gettime code. Older FreeBSD, or FreeBSD on another architecture, >> is likely to be a lot worse. But I lack an installation to try. > That commit is in every 'production' and 'legacy' release of > FreeBSD[1], meaning as far back as 9.3 (expected to be EoL in the next > few days), because it landed in 9.2 (EoL). I'm unclear on whether there's any significant number of people running out-of-support *BSD releases. If it's not something we have to worry about, fine. > That leaves the following architectures without > fast-path time functions: > macaque:freebsd munro$ git grep 'trivial-vdso_tc.c' > lib/libc/mips/sys/Makefile.inc:SRCS+=3D trivial-vdso_tc.c > lib/libc/powerpc/Makefile.inc:SRCS+=3D trivial-vdso_tc.c > lib/libc/powerpc64/Makefile.inc:SRCS+=3D trivial-vdso_tc.c > lib/libc/powerpcspe/Makefile.inc:SRCS+=3D trivial-vdso_tc.c > lib/libc/riscv/sys/Makefile.inc:SRCS+=3D trivial-vdso_tc.c > lib/libc/sparc64/Makefile.inc:SRCS+=3D trivial-vdso_tc.c Yeah, I just finished getting results from FreeBSD 10.3 on PPC (1.33GHz G4 laptop): gettimeofday takes about 1180 ns and clock_gettime about 1200 ns. That difference seems to be repeatable, but since it's only 2% I'm not too fussed about it. Interestingly, it's very easy to tell that it is entering the kernel, because time(1) shows a significant fraction of system time: $ time ./testclock 0 bogus readings 100000000 distinct readings 117.96 real 26.80 user 90.31 sys The same test on platforms with vDSO support shows zero system time. regards, tom lane --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers