[OT]: resolution of PerformanceCounter under NT
Jon Nicoll
jkn at nicorp.f9.co.uk
Mon Jun 25 05:41:02 EDT 2001
Hello there
Further to my recent posting about using calldll to call the Win32
API functions QuesryPerformanceCounter()/QueryPerformanceFrequency():
:: begin
import calldll
import struct
m = calldll.load_library('kernel32')
f = calldll.get_proc_address(m, 'QueryPerformanceFrequency')
p = calldll.membuf(4)
px = p.address()
if calldll.call_foreign_function(f, 'l', 'l', (px,)):
res = p.read(0, 4)
print struct.unpack('l', res)[0]
:: end
I find that I get a return value, on my Dell Precision 410 running
NT4/SP5, of:
>>> 448630000
ie 448e06, which looks to me rather like the Performance counter is
using the Timestamp Register (via the RDTSC instruction, presumably)
running at the CPU's clock frequency (?). This surprised me, as I'm
used to seeing a resolution of 873nSec or so.
Anyone know if this is generally true under NT, or under what
circumstances I'm likely to get the different resolutions of the
Performance Counter?
Thanks for any pointers
Regards
jon Nicoll
More information about the Python-list
mailing list