summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/src/loop.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/core/src/loop.c b/src/core/src/loop.c
index 774ac86..d80e350 100644
--- a/src/core/src/loop.c
+++ b/src/core/src/loop.c
@@ -315,17 +315,6 @@ i32 engine_run(Platform* p, StateType initial_state, void* state_arg) {
const f64 dt = now - time;
time = now;
-//#ifdef BENCHMARK
- if (now - last_fps_measurement > 1.000) {
- 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;
- }
-//#endif
-
glfwPollEvents();
/* Events */
// if (p->mouse_lclick) {
@@ -385,6 +374,27 @@ i32 engine_run(Platform* p, StateType initial_state, void* state_arg) {
render_present(p->window);
const f64 rendertime_dt = get_time() - rendertime_begin;
+
+ /* Print stats */
+ const f64 now = get_time();
+ const f64 dt_measurement = now - last_fps_measurement;
+ /* only make measurements once a second */
+ if (dt_measurement > 1000.0) {
+
+ printf(" FPS: %.1f"
+ "\tticks: %lu"
+ "\tframetime: %.1fms"
+ "\trendertime: %.2fms"
+ "\n"
+ , ((f64)(ticks - last_fps_ticks)) / (dt_measurement / 1000.0)
+ , ticks
+ , dt
+ , rendertime_dt
+ );
+
+ last_fps_measurement = now;
+ last_fps_ticks = ticks;
+ }
}