Sign in to follow this  

QueryPerformanceCounter Performance

This topic is 4257 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
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
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

This topic is 4257 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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