Skip to content

Commit

Permalink
Add perf trace when sleeping due to target_fps
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored and SanderMertens committed Sep 5, 2024
1 parent 720f9b6 commit fd415b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions distr/flecs.c
Original file line number Diff line number Diff line change
Expand Up @@ -19200,6 +19200,8 @@ ecs_ftime_t flecs_insert_sleep(
return delta_time;
}

ecs_os_perf_trace_push("flecs.insert_sleep");

ecs_ftime_t target_delta_time =
((ecs_ftime_t)1.0 / (ecs_ftime_t)world->info.target_fps);

Expand All @@ -19223,6 +19225,8 @@ ecs_ftime_t flecs_insert_sleep(
} while ((target_delta_time - delta_time) >
(sleep_time / (ecs_ftime_t)2.0));

ecs_os_perf_trace_pop("flecs.insert_sleep");

*stop = now;
return delta_time;
}
Expand Down
4 changes: 4 additions & 0 deletions src/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,8 @@ ecs_ftime_t flecs_insert_sleep(
return delta_time;
}

ecs_os_perf_trace_push("flecs.insert_sleep");

ecs_ftime_t target_delta_time =
((ecs_ftime_t)1.0 / (ecs_ftime_t)world->info.target_fps);

Expand All @@ -1814,6 +1816,8 @@ ecs_ftime_t flecs_insert_sleep(
} while ((target_delta_time - delta_time) >
(sleep_time / (ecs_ftime_t)2.0));

ecs_os_perf_trace_pop("flecs.insert_sleep");

*stop = now;
return delta_time;
}
Expand Down

0 comments on commit fd415b7

Please sign in to comment.