View Full Version : Timing
I had to keep things syncronized in my OpenGL engine. So I use win32's GetTickCount() to have a idea how many time went past since the last update. I've heard of QueryPerformanceCounter(), which should do the same job, just with higher resolution. But MSDN says that it isn't avaible on all systems. What does this mean ? What kind of systems are that ? Only crappy old system that aren't worth to care ? Are there any other methods to do proper timing, what do u suggest me ?
02-19-2000, 11:53 AM
according to microsoft's platform SDK docs, on Win95 and WinNT QueryPerformanceCounter is present, and on Win32s it is not.
i've built a framework, wich among the other things, gives me a unified interface to windows timers.
upon startup, it looks for the performance counter. if don't found, it reverts to the multimedia timer timeGetTime(), wich have a 1 msec precision.
i've tested the framework under NT and 98 (first and SE), and on both systems it uses the performance counter.
maybe it's just a case...
btw, can anyone tell me what win32 is? i always thought it was windows 98, but who knows...
tcs, if you wish to don't complicate things i suggest to use the multimedia timer.
wanna make a deal ? I tell you what win32 is, and you give me your timer code ? ;-))
win32 is the 32 bit api that was introduced with some version of win nt (don't know - was nt 32 bit from the start ?). win 95,98,nt4,2000 are win32, too. The term basical means that the 32 bit executable format is supported and that you have acess to all OS functions that are described in the win32 sdk...
about the deal, no problem: i'll send you by email.
02-19-2000, 11:08 PM
I was under the impression that queryperformancecounter was availible only on pentium and above processors..
Anyone using win9x on a 486? http://www.opengl.org/discussion_boards/ubb/smile.gif
Yes, please send it by mail ! Hmmm a 486 isn't worth to care. If the counter is avaible on all at least pentium class CPUs, that should be ok. I just want to avoid that it is avaible on a Athlon and not on a PIII or so....
I swichted over from gettickcount() to the multimedia timer functions. They are as easy to use as gettickcount. The mm timer reports that it uses a accurancy of 1ms, which is pretty cool compared to the 55ms of gettickcount under win98...
Hope I can add some clarification:
Win32: Microsoft API, present in W95, W98, NT (all versions of NT), and maybe WINE =).
Win32s: 16/32 bit "thunked" API present in W3.1, 3.11, and OS/2.
Win32 is the native API for Win95 and 98. Under NT Win32 runs as a seperate "subsystem" - a layer above the kernel. There is also a Posix subsystem and a OS/2 subsystem.
Timers: you don't get much better than QueryPerformanceCounter() - under Win9x GetTickCount()'s granularity seems to be between 10 and 25 ms. NT seems a bit better (8-15 ms). I do have a suggestion though for getting a good heartbeat: use a COMM port! Set the baud to 9600, send a character then terminate the transfer. This operation "stalls" for 1/9600 sec. Use it in a separate thread and update a global variable.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.