Sign in to follow this  
maxest

[DX9/DX10] Profiling

Recommended Posts

maxest    622
I've added some profiling calls to my renderer. Basically, it looks like this:
[code]
void CRenderer::beginTimeQuery()
{
#ifdef RENDERER_D3D9
eventQuery->Issue(D3DISSUE_END);
while (eventQuery->GetData(NULL, 0, D3DGETDATA_FLUSH) == S_FALSE);
QueryPerformanceCounter(&beginTime);
#elif RENDERER_D3D10
timestampDisjointQuery->Begin();
beginTimestampQuery->End();
#endif
}

double CRenderer::endTimeQuery()
{
#ifdef RENDERER_D3D9
eventQuery->Issue(D3DISSUE_END);
while (eventQuery->GetData(NULL, 0, D3DGETDATA_FLUSH) == S_FALSE);
QueryPerformanceCounter(&endTime);
return (double)(endTime.QuadPart - beginTime.QuadPart) / (double)timeFrequency.QuadPart;
#elif RENDERER_D3D10
endTimestampQuery->End();
timestampDisjointQuery->End();
uint64 beginTime, endTime;
D3D10_QUERY_DATA_TIMESTAMP_DISJOINT disjoint;
while (beginTimestampQuery->GetData(&beginTime, sizeof(uint64), 0) != S_OK);
while (endTimestampQuery->GetData(&endTime, sizeof(uint64), 0) != S_OK);
while (timestampDisjointQuery->GetData(&disjoint, sizeof(D3D10_QUERY_DATA_TIMESTAMP_DISJOINT), 0) != S_OK);
if (!disjoint.Disjoint)
return (double)(endTime - beginTime) / (double)disjoint.Frequency;
else
return -1.0;
#endif
}
[/code]

Now, I render 2500 cubes, what gives me 230 FPS with both renderers. The problem is that the timings returned by endTimeQuery differ. For D3D9 it returns 0.003 and for D3D10 returns 0.0013. The rendering code does not do anything else and I wrapped the whole rendering loop inside the begin/end time block. So, where does this discrepancy could come from?

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