Martijn van Oosterhout <kleptog@svana.org> writes:
> Interestingly, I notice the windows port of PostgreSQL uses the
> QueryPerformanceCounter() function. I tried playing with it under linux
> and found that Linux suspends the CPU while waiting for things to
> happen. So:
> sleep(1) ~ 20 million cycles
> busy loop for 1 second ~ 800 million cycles (CPU speed)
> So, what's good for battery and power usage is bad for accurate
> timings. Basically, on Linux it would seriously underestimate the time
> for blocking system calls on an otherwise idle system. So, it works for
> Windows because they don't do this...
Hmm ... are we *sure* they don't do that? The QueryPerformanceCounter
implementation was added just recently, and I'm not sure it's been
tested under any wide range of scenarios. Maybe we will find that it
doesn't work :-(
regards, tom lane