Re: explain analyze timings

John A Meinel <[email protected]> Sun, 20 Mar 2005 10:01:39 -0600
Newsgroups gmane.comp.db.postgresql.devel.win32
Message-ID <[email protected]>
Simon Riggs wrote:

>On Sun, 2005-03-20 at 14:42 +0100, Magnus Hagander wrote:
>  
>
>>>>There is. I beleive QueryPerformanceCounter has sub-mirosecond
>>>>resolution.
>>>>        
>>>>
>>>>Can we just replace gettimeofday() with a version that's basically:
>>>>        
>>>>
>>>No, because it's also used for actual time-of-day calls.  It'd be
>>>necessary to hack executor/instrument.c in particular.
>>>      
>>>
>>Here's a patch that does just this.
>>
>>On my system, the counter resolution is 3192090000 ticks per second
>>(Intel Xeon CPU). On a AMD Athlon XP system, it's 3579545 ticks per
>>second (a lot less, but still way way way better than gettimeofday has
>>on win32).
>>    
>>
>
>Is this just a Win32 hack?
>
>I've been looking for a sub-millisecond counter on other OS for a while
>now...anybody know of any port specific counters elsewhere?
>
>Thanks,
>
>  
>
gettimeofday has microsecond resolution. And on most platforms you 
actually do get good resolution from it.
QueryPerformanceCounter is win32 only, and it has variable resolution, 
as determined by QueryPerformanceFrequency. (obviously as above the Xeon 
claims 3B/s while Athlon is only 3.5M/s)
But that is just the finest resolution they can show, you still need to 
test to see what the resolution they can give you.
On my dual Xeon I get Freq=2399360000 =2.4B/s In testing, the call 
overhead seems to be about .35us, so the resolution is just < 1us.

>Best Regards, Simon Riggs
>  
>
John
=:->
signature.asc (application/pgp-signature, 253 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCPZ5mJdeBCYSNAAMRAtkuAJ47hi1euc2Z/Fn4paepTXF/3jkFXgCfQvqD
KSDJ9CyADPJuIY5T4zZGkLc=
=fI9V
-----END PGP SIGNATURE-----