timing individual passes

Started by
1 comment, last by jollyjeffers 16 years, 8 months ago
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?
"It's better to regret something you've done than to regret something you haven't done."
Advertisement
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.
deathkrushPS3/Xbox360 Graphics Programmer, Mass Media.Completed Projects: Stuntman Ignition (PS3), Saints Row 2 (PS3), Darksiders(PS3, 360)
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

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement