App: Print average frame-time on exit

This commit is contained in:
Riyyi
2024-08-10 21:58:50 +02:00
parent b5f3cae5ba
commit faacdca424
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -171,7 +171,9 @@ int Application::run()
constexpr glm::mat4 matIdentity { 1.0f };
constexpr TransformComponent transformIdentity;
// m_window->setVSync(false);
double gametime = 0;
uint64_t frames = 0;
while (!m_window->shouldClose()) {
float time = Time::time();
@@ -179,6 +181,9 @@ int Application::run()
m_lastFrameTime = time;
// ruc::debug("Frametime {}ms", deltaTime * 1000);
gametime += deltaTime;
frames++;
// ---------------------------------
// Update
@@ -224,6 +229,8 @@ int Application::run()
ruc::debug("Application shutdown");
ruc::debug("Average frametime: {:.2f}ms", (gametime / frames) * 1000);
return m_status;
}