Re: gettimeofday is at the end of its usefulness?

From: Greg Stark <stark(at)mit(dot)edu>
To: Benedikt Grundmann <bgrundmann(at)janestreet(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: gettimeofday is at the end of its usefulness?
Date: 2014-05-15 10:31:24
Message-ID: CAM-w4HO8tFTLJXAWHh0oL+dePXT8yyggBiXif0g-Vwb3wUupWw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 15, 2014 at 8:19 AM, Benedikt Grundmann
<bgrundmann(at)janestreet(dot)com> wrote:
> I posted this on this mailing list before at Jane Street we have developed
> very fast code to get timing information based on TSC if available. It's
> all ocaml but well documented and mostly just calls to c functions so should
> be easy to port to C and we release it under a very liberal license so it
> should be no problem to take the ideas:

What OS do you run it on though? How fast is your implementation
compared to the kernel implementation of clock_gettime()?

Are you sure your implementation is actually faster? And are you sure
you're protected against clocks going backwards? I think you should
put some i/o in the loop in the test and start several threads running
it to make it more likely the thread is rescheduled to a different
processor during the test. It suspect you'll find the rdtsc goes
backwards sometimes or produces crazy results when switching
processors.

--
greg

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Benedikt Grundmann 2014-05-15 11:04:25 Re: gettimeofday is at the end of its usefulness?
Previous Message Heikki Linnakangas 2014-05-15 09:20:29 Re: popen and pclose redefinitions causing many warning in Windows build