summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2024-03-03 12:31:03 +0000
committer0scar <qgt268@alumni.ku.dk>2024-03-03 12:40:58 +0000
commit663627742685c1f52ec1ad92c73d3c650c3e1536 (patch)
tree6721c421c23fb4c53f2fe5257b6c36b1a93e1ac9 /src/core
parentc1bfbb0444bd4bab3caa44a7a8e1979725ac2226 (diff)
Measure frametime
Diffstat (limited to 'src/core')
-rw-r--r--src/core/src/loop.c10
1 files changed, 9 insertions, 1 deletions
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++;