Archived

This topic is now archived and is closed to further replies.

core

Availability of High-Resolution PC Timers

Recommended Posts

core    106
Can anyone give a rough approximation of what percent of PC''s are capable of high-res timers, such as that used by the QueryPerformance* Win32 functions? "If people are good only because they fear punishment and hope for reward, then we are a sorry lot indeed." - Albert Einstein

Share this post


Link to post
Share on other sites
jollyjeffers    1570
it''s accurate for most things, but if you want to do some serious debugging then GetTickCount() sucks... I read some whitepapers indicating that GetTickCount() is only accurate to 7-10ms on some system configurations. That aint any use

However, to answer the question, I think everything from the later 386''s onwards have high-frequency timers, failing that, all Pentium (and above) systems do (I''m 99.999999% sure i read that some one)...

I doubt you''ll come across a computer this day-and-age that doesn''t support QueryPerformance*** calls

Jack;

Share this post


Link to post
Share on other sites
Facehat    696
I''m pretty sure that all Pentium class proccessors have the high performance timers except some of the early model Cyrix chips. But who uses a Cyrix for games anyway?

----------------------------------
AIM: IanWinsAgain ICQ: 60635592 TIM: FaceHat
FaceHat Software -- Wear the hat.

Share this post


Link to post
Share on other sites
core    106
Thanks a bunch.

GetTickCount = suck
EDIT: Cyrix = suck

"If people are good only because they fear punishment and hope for reward, then we are a sorry lot indeed." - Albert Einstein

Edited by - core on January 15, 2002 6:47:28 PM

Share this post


Link to post
Share on other sites
Brannon    122
GetTickCount() doesn''t suck.

GetTickCount() has almost zero overhead (it just queries a location in memory that is updated by the OS every so often (around 10ms or so)).

QueryPerformanceCounter() is very expensive compared to GetTickCount().

There are also the multimedia timers, using timeBeginTime(), timeGetTime(), and timeEndTime() you can get very accurate timing on just about any computer. Why? Because timeBeginTime() changes the clock frequency (it should also improve the resolution of GetTickCount(), but I don''t remember for sure if that''s the case).

Just choose the correct tool for the job. In most cases, GetTickCount() is perfect.

-Brannon

Share this post


Link to post
Share on other sites
Zaei    122
Using GetTickCount(), you can get 1000 fps, or 100 fps, but nothing in between(10ms accuracy). Likewise, I hear that on certain systems, the frequency on the clock changes to save power, while QueryPerformance*** calls use a method that avoids this.

Z.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Be careful, QueryPerformanceCounter will also jump 20 milliseconds at a time when the OS kicks you off for thread shareing, making it almost unuseable for profiling.

Share this post


Link to post
Share on other sites
Abominacion    207
Brannon:
QueryPerformanceCounter() is just the rdtsc instruction so it isn´t expensive (6/13 clock cycles on a PPlain or a PMMX, 31 micro-ops on a PPro,PII or a PIII acording to Agner Fog).

------------------------------------------------------
Cuando miras al abismo el abismo te devuelve la mirada.
F. Nietzsche

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Yes Brannon,

You''ve got your counters mixed up, its QueryPerformanceCounter that executes on op on the processor and GetTickCount that has the overhead of a windows function call. However, the previous AP was correct in saying that QueryPerformanceCounter, will jump every few seconds or so.

Share this post


Link to post
Share on other sites
Abominacion    207
I have to apologize because my previous post was wrong, I have disassembled both functions and while GetTickCount() is pretty simple:

Exported fn(): GetTickCount - Ord:01D6h
:BFF76A3C 668E2D109DFCBF mov gs, [BFFC9D10]
:BFF76A43 65A100000000 mov eax, dword ptr gs:[00000000]
:BFF76A49 2BD2 sub edx, edx
:BFF76A4B 8EEA mov gs, dx
:BFF76A4D C3 ret

QueryPerformanceCounter() is a lot messier, despite the fact it should be just the rdtsc instruction.

------------------------------------------------------
Cuando miras al abismo el abismo te devuelve la mirada.
F. Nietzsche

Share this post


Link to post
Share on other sites