Re: gettimeofday is at the end of its usefulness? - Mailing list pgsql-hackers

From Robert Haas
Subject Re: gettimeofday is at the end of its usefulness?
Date
Msg-id CA+TgmoZyAACNS2SD48804BQeTz5DaS2WNLZx-rmFXCLYBJm=Fw@mail.gmail.com
Whole thread Raw
In response to Re: gettimeofday is at the end of its usefulness?  (Greg Stark <stark@mit.edu>)
Responses Re: gettimeofday is at the end of its usefulness?  (Benedikt Grundmann <bgrundmann@janestreet.com>)
List pgsql-hackers
On Tue, May 13, 2014 at 11:34 PM, Greg Stark <stark@mit.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



pgsql-hackers by date:

Previous
From: Ants Aasma
Date:
Subject: Re: gettimeofday is at the end of its usefulness?
Next
From: Heikki Linnakangas
Date:
Subject: Re: buildfarm / handling (undefined) locales