timing individual passes
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?
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.
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...
hth
Jack
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 deathkrushTechnically 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.
In DirectX you can use IDirect3DQuery9 to obtain various GPU counters.
hth
Jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement