Sign in to follow this  
UBrothers

QueryPerformanceCounter Performance

Recommended Posts

UBrothers    104
Hi all, this is not really a DirectX question, but I am developing game that uses DirectX and I wan to know your opinion on this: I am using QueryPerformanceCounter function for game timing and I am calling it quite often per frame (each animated object is timed using this function), so what do you think - is it ok to call QueryPerformanceCounter function often ? Do you think, that it can lower the framerate ? Thanx, Stf

Share this post


Link to post
Share on other sites
Evil Steve    2017
I'd advise wrapping it into a global timer class or something, that'll only actually call QueryPerformanceCounter every frame. The performance shouldn't be too bad, but it's best to avoid calling it too often.

EDIT: Waaay too late [smile]

Share this post


Link to post
Share on other sites
Dtag    210
Hey

Performance Counters are very precise, but the precision comes at a quite high cost. Querying the timer too often will hurt performance. If you really need to do lots of queries, you should try looking at RDTSC.
More information on timer performance can be found here:
http://www.nvidia.com/object/timer_function_performance.html

Edit: If your really using this for animation of objects, you should do what the first replyers suggested. If you need further timing functions ( say for an in-game profiler or anything similar ), it may be worth looking at RDTSC etc.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this