Re: gettimeofday is at the end of its usefulness?

From: Benedikt Grundmann <bgrundmann(at)janestreet(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Greg Stark <stark(at)mit(dot)edu>, 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 07:20:26
Message-ID: CADbMkNP18FUMCeYeGh-kvZR49Auy2wim54s2eziwYzPN3LbLRA@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:
>
> https://github.com/janestreet/core/blob/master/lib/time_stamp_counter.mli
>
> Hope this is useful.
>
> Bene
>
>
Also I'm sorry for top posting. hackers is the only mailing list I'm on
that requires this and some others require top posting so this runs counter
my habits and I only realized after sending...

>
> On Wed, May 14, 2014 at 12:41 PM, Robert Haas <robertmhaas(at)gmail(dot)com>wrote:
>
>> On Tue, May 13, 2014 at 11:34 PM, Greg Stark <stark(at)mit(dot)edu> wrote:
>> > I always assumed the kernel used rdtsc to implement some of the high
>> > performance timers. It can save the current time in a mapped page when
>> > it schedules a process and then in the vdso syscall (ie in user-space)
>> > it can use rdtsc to calculate the offset needed to adjust that
>> > timestamp to the current time. This seems consistent with your
>> > calculations that showed the 40ns overhead with +/- 10ns precision.
>>
>> Crazy idea: Instead of trying to time precisely the amount of time we
>> spend in each node, configure a very-high frequency timer interrupt
>> (or background thread?) that does:
>>
>> SomeGlobalVariablePointingToTheCurrentNode->profiling_counter++;
>>
>> --
>> Robert Haas
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>> --
>> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-hackers
>>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Emre Hasegeli 2014-05-15 08:33:55 Selectivity estimation for inet operators
Previous Message Benedikt Grundmann 2014-05-15 07:19:16 Re: gettimeofday is at the end of its usefulness?