collect profile of startup and pack resolution

This commit is contained in:
veclavtalica 2025-01-15 04:47:36 +03:00
parent 760515c551
commit 1ba33bdc26

View File

@ -351,8 +351,10 @@ static bool initialize(void) {
/* that is why PhysicsFS is initialized before anything else */ /* that is why PhysicsFS is initialized before anything else */
toml_set_memutil(SDL_malloc, SDL_free); toml_set_memutil(SDL_malloc, SDL_free);
profile_start("resolve_pack_dependencies()");
/* time to orderly resolve any dependencies present */ /* time to orderly resolve any dependencies present */
resolve_pack_dependencies("data"); resolve_pack_dependencies("data");
profile_end("resolve_pack_dependencies()");
/* load the config file into an opaque table */ /* load the config file into an opaque table */
{ {
@ -710,6 +712,8 @@ static void reset_state(void) {
int enter_loop(int argc, char **argv) { int enter_loop(int argc, char **argv) {
profile_start("startup");
ctx.argc = argc; ctx.argc = argc;
ctx.argv = argv; ctx.argv = argv;
ctx.base_dir = SDL_GetBasePath(); ctx.base_dir = SDL_GetBasePath();
@ -793,6 +797,8 @@ int enter_loop(int argc, char **argv) {
ctx.was_successful = true; ctx.was_successful = true;
ctx.game.initialization_needed = true; ctx.game.initialization_needed = true;
profile_end("startup");
while (ctx.is_running) { while (ctx.is_running) {
if (game_object_try_reloading()) { if (game_object_try_reloading()) {
ctx.game.initialization_needed = true; ctx.game.initialization_needed = true;
@ -802,7 +808,8 @@ int enter_loop(int argc, char **argv) {
main_loop(); main_loop();
} }
profile_list_stats(); if (ctx.game.debug)
profile_list_stats();
/* loop is over */ /* loop is over */
game_object_unload(); game_object_unload();