Fixed game time stats

This commit is contained in:
Robert Beckebans 2020-03-29 18:19:03 +02:00
parent 62466b41b7
commit 33129bf5b8
2 changed files with 25 additions and 19 deletions

View file

@ -63,6 +63,7 @@ public:
{
threadTime = inTime;
}
int GetThreadTotalTime() const
{
return threadTime;
@ -310,22 +311,22 @@ public:
return gameThread.GetThreadRenderTime();
}
int GetRendererBackEndMicroseconds() const
uint64 GetRendererBackEndMicroseconds() const
{
return time_backend;
}
int GetRendererShadowsMicroseconds() const
uint64 GetRendererShadowsMicroseconds() const
{
return time_shadows;
}
int GetRendererIdleMicroseconds() const
uint64 GetRendererIdleMicroseconds() const
{
return mainFrameTiming.startRenderTime - mainFrameTiming.finishSyncTime;
}
int GetRendererGPUMicroseconds() const
uint64 GetRendererGPUMicroseconds() const
{
return time_gpu;
}

View file

@ -267,14 +267,19 @@ float idConsoleLocal::DrawFPS( float y )
}
// DG end
const int gameThreadTotalTime = commonLocal.GetGameThreadTotalTime();
const int gameThreadGameTime = commonLocal.GetGameThreadGameTime();
const int gameThreadRenderTime = commonLocal.GetGameThreadRenderTime();
const int rendererBackEndTime = commonLocal.GetRendererBackEndMicroseconds();
const int rendererShadowsTime = commonLocal.GetRendererShadowsMicroseconds();
const int rendererGPUIdleTime = commonLocal.GetRendererIdleMicroseconds();
const int rendererGPUTime = commonLocal.GetRendererGPUMicroseconds();
const int maxTime = 16;
//const uint64 gameThreadTotalTime = commonLocal.GetGameThreadTotalTime();
//const uint64 gameThreadGameTime = commonLocal.GetGameThreadGameTime();
//const uint64 gameThreadRenderTime = commonLocal.GetGameThreadRenderTime();
const uint64 gameThreadTotalTime = commonLocal.mainFrameTiming.finishDrawTime - commonLocal.mainFrameTiming.startGameTime;
const uint64 gameThreadGameTime = commonLocal.mainFrameTiming.finishGameTime - commonLocal.mainFrameTiming.startGameTime;
const uint64 gameThreadRenderTime = commonLocal.mainFrameTiming.finishDrawTime - commonLocal.mainFrameTiming.finishGameTime;
const uint64 rendererBackEndTime = commonLocal.GetRendererBackEndMicroseconds();
const uint64 rendererShadowsTime = commonLocal.GetRendererShadowsMicroseconds();
const uint64 rendererGPUIdleTime = commonLocal.GetRendererIdleMicroseconds();
const uint64 rendererGPUTime = commonLocal.GetRendererGPUMicroseconds();
const int maxTime = 16 * 1000;
#if !defined( USE_VULKAN )
@ -340,13 +345,13 @@ float idConsoleLocal::DrawFPS( float y )
ImVec4 colorWhite( 1.0f, 1.0f, 1.0f, 1.0f );
ImVec4 colorRed( 1.0f, 0.0f, 0.0f, 1.0f );
ImGui::TextColored( gameThreadTotalTime > maxTime ? colorRed : colorWhite, "G+RF: %4d ms", gameThreadTotalTime );
ImGui::TextColored( gameThreadGameTime > maxTime ? colorRed : colorWhite, "G: %4d ms", gameThreadGameTime );
ImGui::TextColored( gameThreadRenderTime > maxTime ? colorRed : colorWhite, "RF: %4d ms", gameThreadRenderTime );
ImGui::TextColored( rendererBackEndTime > maxTime * 1000 ? colorRed : colorWhite, "RB: %4d ms", int( rendererBackEndTime ) );
ImGui::TextColored( rendererShadowsTime > maxTime * 1000 ? colorRed : colorWhite, "SHADOWS: %4d ms", int( rendererShadowsTime ) );
ImGui::TextColored( rendererGPUIdleTime > maxTime * 1000 ? colorRed : colorWhite, "IDLE: %4d ms", int( rendererGPUIdleTime ) );
ImGui::TextColored( rendererGPUTime > maxTime * 1000 ? colorRed : colorWhite, "GPU: %4d ms", int( rendererGPUTime ) );
ImGui::TextColored( gameThreadTotalTime > maxTime ? colorRed : colorWhite, "G+RF: %5llu us", gameThreadTotalTime );
ImGui::TextColored( gameThreadGameTime > maxTime ? colorRed : colorWhite, "G: %5llu us", gameThreadGameTime );
ImGui::TextColored( gameThreadRenderTime > maxTime ? colorRed : colorWhite, "RF: %5llu us", gameThreadRenderTime );
ImGui::TextColored( rendererBackEndTime > maxTime ? colorRed : colorWhite, "RB: %5llu us", rendererBackEndTime );
ImGui::TextColored( rendererShadowsTime > maxTime ? colorRed : colorWhite, "SHADOWS: %5llu us", rendererShadowsTime );
ImGui::TextColored( rendererGPUIdleTime > maxTime ? colorRed : colorWhite, "IDLE: %5llu us", rendererGPUIdleTime );
ImGui::TextColored( rendererGPUTime > maxTime ? colorRed : colorWhite, "GPU: %5llu us", rendererGPUTime );
ImGui::End();
}