[MIRROR] The profiler now starts earlier into the init process. + Documents the initialization order and pipeline (#319)

* The profiler now starts earlier into the init process. + Documents the initialization order and pipeline (#52662)

* The profiler now starts earlier into the init process.
Also documents the init pipeline and order in world/New()'s codedoc.

* better early profiler

* NEWMAN!

* The profiler now starts earlier into the init process. + Documents the initialization order and pipeline

Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
This commit is contained in:
SkyratBot
2020-08-13 00:19:33 +02:00
committed by GitHub
co-authored by Kyle Spier-Swenson
parent 9c61a4bf79
commit e28b80eca2
4 changed files with 19 additions and 9 deletions
+4
View File
@@ -0,0 +1,4 @@
#if DM_BUILD >= 1506
// We don't actually care about storing the output here, this is just an easy way to ensure the profile runs first.
GLOBAL_REAL_VAR(world_init_profiler) = world.Profile(PROFILE_START)
#endif
+1 -1
View File
@@ -18,7 +18,7 @@ SUBSYSTEM_DEF(profiler)
if(CONFIG_GET(flag/auto_profile))
StartProfiling()
else
StopProfiling() //Stop the early start from world/New
StopProfiling() //Stop the early start profiler
return ..()
/datum/controller/subsystem/profiler/fire()
+13 -8
View File
@@ -5,18 +5,28 @@ GLOBAL_VAR(restart_counter)
/**
* World creation
*
* Here is where a round itself is actually begun and setup, lots of important config changes happen here
* Here is where a round itself is actually begun and setup.
* * db connection setup
* * config loaded from files
* * loads admins
* * Sets up the dynamic menu system
* * and most importantly, calls initialize on the master subsystem, starting the game loop that causes the rest of the game to begin processing and setting up
*
* Note this happens after the Master subsystem is created (as that is a global datum), this means all the subsystems exist,
* but they have not been Initialized at this point, only their New proc has run
*
* Nothing happens until something moves. ~Albert Einstein
*
* For clarity, this proc gets triggered later in the initialization pipeline, it is not the first thing to happen, as it might seem.
*
* Initialization Pipeline:
* Global vars are new()'ed, (including config, glob, and the master controller will also new and preinit all subsystems when it gets new()ed)
* Compiled in maps are loaded (mainly centcom). all areas/turfs/objs/mobs(ATOMs) in these maps will be new()ed
* world/New() (You are here)
* Once world/New() returns, client's can connect.
* 1 second sleep
* Master Controller initialization.
* Subsystem initialization.
* Non-compiled-in maps are maploaded, all atoms are new()ed
* All atoms in both compiled and uncompiled maps are initialized()
*/
/world/New()
var/extools = world.GetConfig("env", "EXTOOLS_DLL") || (world.system_type == MS_WINDOWS ? "./byond-extools.dll" : "./libbyond-extools.so")
@@ -27,11 +37,6 @@ GLOBAL_VAR(restart_counter)
enable_reference_tracking()
#endif
//Early profile for auto-profiler - will be stopped on profiler init if necessary.
#if DM_BUILD >= 1506
world.Profile(PROFILE_START)
#endif
log_world("World loaded at [time_stamp()]!")
make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once)
+1
View File
@@ -18,6 +18,7 @@
#include "code\world.dm"
#include "code\__DEFINES\_globals.dm"
#include "code\__DEFINES\_helpers.dm"
#include "code\__DEFINES\_profile.dm"
#include "code\__DEFINES\_protect.dm"
#include "code\__DEFINES\_tick.dm"
#include "code\__DEFINES\access.dm"