From 663627742685c1f52ec1ad92c73d3c650c3e1536 Mon Sep 17 00:00:00 2001 From: 0scar Date: Sun, 3 Mar 2024 13:31:03 +0100 Subject: Measure frametime --- src/core/src/loop.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/core') diff --git a/src/core/src/loop.c b/src/core/src/loop.c index deb3768..a950a9f 100644 --- a/src/core/src/loop.c +++ b/src/core/src/loop.c @@ -301,7 +301,10 @@ i32 engine_run(Platform* p, StateType initial_state, void* state_arg) { //#ifdef BENCHMARK if (now - last_fps_measurement > 1.000) { - printf("\n FPS: %.1f \t ticks: %lu", (double)(ticks - last_fps_ticks) / (now - last_fps_measurement), ticks); + printf("\n FPS: %.1f \t ticks: %lu \t frametime: %.1f" + , (double)(ticks - last_fps_ticks) / (now - last_fps_measurement) + , ticks + , dt * 1000.f); last_fps_measurement = now; last_fps_ticks = ticks; } @@ -360,11 +363,16 @@ i32 engine_run(Platform* p, StateType initial_state, void* state_arg) { } } else { + f64 t = get_time(); render_begin(p->window); // ??? render_present(p->window); + + if (last_fps_measurement == now) { + printf("\n rendertime: %.1f", (double)(get_time() - t) * 1000.); + } } ticks++; -- cgit v1.3