Archived

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

IndirectX

Which timer function?

Recommended Posts

There are three timer functions that I know: GetTickCount (10 ms resolution) timeGetTime (1 ms resolution) QueryPerformanceCounter (0.000279365 ms resolution) Resolutions are for my system. Is there any advantage in using the first two functions? They probably are faster, but is the difference noticeable?

Share this post


Link to post
Share on other sites
Isn''t it nice of nvidia to have already done the profiling for you?

http://developer.nvidia.com/view.asp?IO=timer_function_performance

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
i just can''t believe the result.. they say that QueryPerformanceCounter very slow!! but what do those times actually mean?
here are the results that I got:


QueryPerformanceFrequency() freq = 0 1193180

method 0:
QueryPerfCntr..() 100 times
tot: 0 640
avg: 6.400000
avg time: 5.36382e-006
method 0:
QueryPerfCntr..() 500 times
tot: 0 3110
avg: 6.220000
avg time: 5.21296e-006
method 0:
QueryPerfCntr..() 1000 times
tot: 0 7077
avg: 7.077000
avg time: 5.93121e-006
method 0:
QueryPerfCntr..() 10000 times
tot: 0 648581
avg: 64.858100
avg time: 5.43573e-005

method 1:
GetTickCount() 100 times
tot: 0 10
avg: 0.100000
avg time: 8.38097e-008
method 1:
GetTickCount() 500 times
tot: 0 20
avg: 0.040000
avg time: 3.35239e-008
method 1:
GetTickCount() 1000 times
tot: 0 35
avg: 0.035000
avg time: 2.93334e-008
method 1:
GetTickCount() 10000 times
tot: 0 289
avg: 0.028900
avg time: 2.4221e-008

method 2:
TimeGetTime() 100 times
tot: 0 738
avg: 7.380000
avg time: 6.18515e-006
method 2:
TimeGetTime() 500 times
tot: 0 3567
avg: 7.134000
avg time: 5.97898e-006
method 2:
TimeGetTime() 1000 times
tot: 0 7212
avg: 7.212000
avg time: 6.04435e-006
method 2:
TimeGetTime() 10000 times
tot: 0 111542
avg: 11.154200
avg time: 9.3483e-006

method 3:
Pentium internal high-freq cntr() 100 times
tot: 0 8
avg: 0.080000
avg time: 6.70477e-008
method 3:
Pentium internal high-freq cntr() 500 times
tot: 0 15
avg: 0.030000
avg time: 2.51429e-008
method 3:
Pentium internal high-freq cntr() 1000 times
tot: 0 50
avg: 0.050000
avg time: 4.19048e-008
method 3:
Pentium internal high-freq cntr() 10000 times
tot: 0 315
avg: 0.031500
avg time: 2.64e-008

Share this post


Link to post
Share on other sites