[MIRROR] Log subsystem initialize times in feedback, give more precise displays [MDB IGNORE] (#15932)

* Log subsystem initialize times in feedback, give more precise displays

* conflict

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Tom <8881105+tf-4@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-09-04 14:28:44 +01:00
committed by GitHub
co-authored by Mothblocks Tom
parent 7d766758d6
commit b0c2a0d4c8
4 changed files with 18 additions and 8 deletions
@@ -3,7 +3,7 @@
// All signals send the source datum of the signal as the first argument
///Subsystem signals
///From base of datum/controller/subsystem/Initialize: (start_timeofday)
///From base of datum/controller/subsystem/Initialize
#define COMSIG_SUBSYSTEM_POST_INITIALIZE "subsystem_post_initialize"
///Called when the ticker enters the pre-game phase
+3
View File
@@ -314,3 +314,6 @@
#define SSMACHINES_DT (SSmachines.wait/10)
#define SSMOBS_DT (SSmobs.wait/10)
#define SSOBJ_DT (SSobj.wait/10)
/// The timer key used to know how long subsystem initialization takes
#define SS_INIT_TIMER_KEY "ss_init"
+4 -1
View File
@@ -241,7 +241,10 @@ GLOBAL_REAL(Master, /datum/controller/master) = new
if (subsystem.flags & SS_NO_INIT || subsystem.initialized) //Don't init SSs with the correspondig flag or if they already are initialzized
continue
current_initializing_subsystem = subsystem
subsystem.Initialize(REALTIMEOFDAY)
rustg_time_reset(SS_INIT_TIMER_KEY)
subsystem.Initialize()
CHECK_TICK
current_initializing_subsystem = null
init_stage_completed = current_init_stage
+10 -6
View File
@@ -255,14 +255,18 @@
/datum/controller/subsystem/proc/OnConfigLoad()
//used to initialize the subsystem AFTER the map has loaded
/datum/controller/subsystem/Initialize(start_timeofday)
/datum/controller/subsystem/Initialize()
initialized = TRUE
SEND_SIGNAL(src, COMSIG_SUBSYSTEM_POST_INITIALIZE, start_timeofday)
var/time = (REALTIMEOFDAY - start_timeofday) / 10
var/msg = "Initialized [name] subsystem within [time] second[time == 1 ? "" : "s"]!"
add_startup_message(msg) //SKYRAT EDIT CHANGE
SEND_SIGNAL(src, COMSIG_SUBSYSTEM_POST_INITIALIZE)
var/time = rustg_time_milliseconds(SS_INIT_TIMER_KEY)
var/seconds = round(time / 1000, 0.01)
var/msg = "Initialized [name] subsystem within [seconds] second[seconds == 1 ? "" : "s"]!"
add_startup_message(msg) //SKYRAT EDIT CHANGE - ORIGINAL: to_chat(world, span_boldannounce("[msg]"))
log_world(msg)
return time
SSblackbox.record_feedback("tally", "subsystem_initialize", time, name)
return seconds
/datum/controller/subsystem/stat_entry(msg)
if(can_fire && !(SS_NO_FIRE & flags) && init_stage <= Master.init_stage_completed)