reftracking

This commit is contained in:
Tsurupeta
2023-08-08 14:01:16 +03:00
parent 39600ad9ed
commit eca4935865
5 changed files with 42 additions and 3 deletions
+9 -2
View File
@@ -42,9 +42,16 @@
SEND_TEXT(world.log, text)
#endif
#ifdef REFERENCE_TRACKING_LOG
#if defined(REFERENCE_DOING_IT_LIVE)
#define log_reftracker(msg) log_harddel("## REF SEARCH [msg]")
/proc/log_harddel(text)
WRITE_LOG(GLOB.harddel_log, text)
#elif defined(REFERENCE_TRACKING) // Doing it locally
#define log_reftracker(msg) log_world("## REF SEARCH [msg]")
#else
#else //Not tracking at all
#define log_reftracker(msg)
#endif
+8
View File
@@ -43,6 +43,14 @@
// #define TRACK_MAX_SHARE //Allows max share tracking, for use in the atmos debugging ui
#endif //ifdef TESTING
//#define REFERENCE_DOING_IT_LIVE
#ifdef REFERENCE_DOING_IT_LIVE
// compile the backend
#define REFERENCE_TRACKING
// actually look for refs
#define GC_FAILURE_HARD_LOOKUP
#endif // REFERENCE_DOING_IT_LIVE
//#define UNIT_TESTS //If this is uncommented, we do a single run though of the game setup and tear down process with unit tests in between
#ifndef PRELOAD_RSC //set to:
+5
View File
@@ -87,6 +87,11 @@ GLOBAL_PROTECT(picture_logging_id)
GLOBAL_VAR(picture_logging_prefix)
GLOBAL_PROTECT(picture_logging_prefix)
/////
#ifdef REFERENCE_DOING_IT_LIVE
GLOBAL_LIST_EMPTY(harddel_log)
GLOBAL_PROTECT(harddel_log)
#endif
//// cit logging
GLOBAL_VAR(subsystem_log)
+8
View File
@@ -26,6 +26,10 @@ GLOBAL_LIST(topic_status_cache)
make_datum_references_lists() //initialises global lists for referencing frequently used datums (so that we only ever do it once)
#ifdef REFERENCE_DOING_IT_LIVE
GLOB.harddel_log = GLOB.world_game_log
#endif
GLOB.revdata = new
InitTgs()
@@ -140,6 +144,10 @@ GLOBAL_LIST(topic_status_cache)
#ifdef UNIT_TESTS
GLOB.test_log = "[GLOB.log_directory]/tests.log"
start_log(GLOB.test_log)
#endif
#ifdef REFERENCE_DOING_IT_LIVE
GLOB.harddel_log = "[GLOB.log_directory]/harddels.log"
start_log(GLOB.harddel_log)
#endif
start_log(GLOB.world_game_log)
start_log(GLOB.world_attack_log)
@@ -134,6 +134,15 @@ GLOBAL_LIST_EMPTY(deletion_failures)
DoSearchVar(GLOB, "GLOB") //globals
log_reftracker("Finished searching globals")
//Yes we do actually need to do this. The searcher refuses to read weird lists
//And global.vars is a really weird list
var/global_vars = list()
for(var/key in global.vars)
global_vars[key] = global.vars[key]
DoSearchVar(global_vars, "Native Global", search_time = starting_time)
log_reftracker("Finished searching native globals")
for(var/datum/thing in world) //atoms (don't beleive its lies)
DoSearchVar(thing, "World -> [thing.type]", search_time = starting_time)
log_reftracker("Finished searching atoms")
@@ -143,9 +152,11 @@ GLOBAL_LIST_EMPTY(deletion_failures)
log_reftracker("Finished searching datums")
//Warning, attempting to search clients like this will cause crashes if done on live. Watch yourself
#ifndef REFERENCE_DOING_IT_LIVE
for(var/client/thing) //clients
DoSearchVar(thing, "Clients -> [thing.type]", search_time = starting_time)
log_reftracker("Finished searching clients")
#endif
log_reftracker("Completed search for references to a [type].")
@@ -159,7 +170,7 @@ GLOBAL_LIST_EMPTY(deletion_failures)
/datum/proc/DoSearchVar(potential_container, container_name, recursive_limit = 64, search_time = world.time)
#ifdef REFERENCE_TRACKING_DEBUG
if(!found_refs && SSgarbage.should_save_refs)
if(SSgarbage.should_save_refs && !found_refs)
found_refs = list()
#endif