More GC Fixes and Logging

This commit is contained in:
Fox-McCloud
2017-04-02 03:38:18 -04:00
parent c6abe7822b
commit 0578dc56de
7 changed files with 29 additions and 24 deletions
@@ -7,8 +7,12 @@
#define GC_FORCE_DEL_PER_TICK 30
//#define GC_DEBUG
// A list of types that were queued in the GC, and had to be soft deleted; used in testing
var/list/gc_hard_del_types = list()
var/list/didntgc = list() // list of all types that have failed to GC associated with the number of times that's happened.
// the types are stored as strings
var/list/sleptDestroy = list() //Same as above but these are paths that slept during their Destroy call
var/list/noqdelhint = list() // list of all types that do not return a QDEL_HINT
var/global/datum/controller/process/garbage_collector/garbageCollector
// The time a datum was destroyed by the GC, or null if it hasn't been
@@ -82,7 +86,7 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
#undef GC_COLLECTIONS_PER_TICK
/datum/controller/process/garbage_collector/proc/hardDel(var/datum/D)
gc_hard_del_types["[D.type]"]++
didntgc["[D.type]"]++
D.hard_deleted = 1
if(!D.gcDestroyed)
spawn(-1)
@@ -126,6 +130,7 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
return
if(!isnull(D.gcDestroyed) && D.gcDestroyed != world.time)
gcwarning("Sleep detected in Destroy() call of [D.type]")
sleptDestroy["[D.type]"]++
D.gcDestroyed = world.time
switch(hint)
@@ -155,7 +160,9 @@ var/global/datum/controller/process/garbage_collector/garbageCollector
#endif
garbageCollector.addTrash(D)
else
// to_chat(world, "WARNING GC DID NOT GET A RETURN VALUE FOR [D], [D.type]!")
if(!noqdelhint["[D.type]"])
noqdelhint["[D.type]"] = "[D.type]"
gcwarning("WARNING: [D.type] is not returning a qdel hint. It is being placed in the queue. Further instances of this type will also be queued.")
garbageCollector.addTrash(D)
+14 -11
View File
@@ -13,21 +13,24 @@
log_admin("[key_name(usr)] turned qdel [garbageCollector.del_everything ? "off" : "on"].")
message_admins("\blue [key_name_admin(usr)] turned qdel [garbageCollector.del_everything ? "off" : "on"].", 1)
/client/proc/gc_dump_hdl()
set name = "(GC) Hard Del List"
set desc = "List types that are hard del()'d by the GC."
/client/proc/cmd_display_del_log()
set category = "Debug"
set name = "(GC) Display del() Log"
set desc = "Displays a list of things that have failed to GC this round"
if(!check_rights(R_DEBUG))
return
var/dat = "<B>List of things that failed to GC this round</B><BR><BR>"
for(var/path in didntgc)
dat += "[path] - [didntgc[path]] times<BR>"
if(!gc_hard_del_types || !gc_hard_del_types.len)
to_chat(usr, "<span class='notice'>No hard del()'d types found.</span>")
return
dat += "<B>List of paths that did not return a qdel hint in Destroy()</B><BR><BR>"
for(var/path in noqdelhint)
dat += "[path]<BR>"
to_chat(usr, "Types hard del()'d by the GC and number of times failed:")
for(var/A in gc_hard_del_types)
to_chat(usr, "[A] - [gc_hard_del_types[A]] times")
dat += "<B>List of paths that slept in Destroy()</B><BR><BR>"
for(var/path in sleptDestroy)
dat += "[path]<BR>"
usr << browse(dat, "window=dellog")
#ifdef TESTING
/client/var/running_find_references