Sign in to follow this  
Shai

timing individual passes

Recommended Posts

I got a program which consists of 2 passes. The totale framerate is 370 fps. I'd like to time how many milliseconds are spent on each pass. Is there any way to do this? So far I've tried using GetTickCount and timeGetTime() to get the time at the beginning and at the end of a pass. But when I substract these two values, I always get zero. What am I doing wrong?

Share this post


Link to post
Share on other sites
Since you are measuring CPU time, it's possible that it takes less than a millisecond to do a pass on the CPU, that's why the difference is zero. Try either a microsecond counter or try measuring GPU time instead. In DirectX you can use IDirect3DQuery9 to obtain various GPU counters.

Share this post


Link to post
Share on other sites
Performing profiling is non-trivial at best. If you're using Direct3D ensure that you read the "Accurately profiling Direct3D API calls" page in the SDK documentation.

You're trying to profile a parallel system - the CPU and GPU don't operate in-step, so all you are actually doing is trying to time how long it takes for the CPU to pack up an instruction for the GPU, NOT how long it actually takes the GPU to perform the task.

You can try and flush the pipeline immediately before/after each pass to ensure the CPU and GPU run in step with each other, IDirect3DQuery9 can do this. However whether this data is actually meaningful is debateable as you are no longer timing the same application and extrapolating from serial to parallel may not be correct as the parallelism may well be succesfully hiding apparent bottlenecks when performed serially...

Quote:
Original post by deathkrush
In DirectX you can use IDirect3DQuery9 to obtain various GPU counters.
Technically this is possible, but in my experience only the instrumented drivers will actually expose interesting counter queries. Most of the time the information is simply not available.

hth
Jack

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