mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
Add shitty tool for memory profiling.
VERB: Debug > Dump Instance Counts
This commit is contained in:
@@ -52,12 +52,35 @@
|
||||
var/mob/living/M = src
|
||||
M.take_organ_damage(20)
|
||||
|
||||
/atom/proc/AddToProfiler()
|
||||
// Memory usage profiling - N3X
|
||||
if(type in type_instances)
|
||||
type_instances[type]=type_instances[type]+1
|
||||
else
|
||||
type_instances[type]=1
|
||||
|
||||
/atom/proc/DeleteFromProfiler()
|
||||
// Memory usage profiling - N3X
|
||||
if(type in type_instances)
|
||||
type_instances[type]=type_instances[type]-1
|
||||
else
|
||||
type_instances[type]=0
|
||||
warning("Type [type] does not inherit /atom/New(). Please ensure ..() is called, or that the type at least adds to type_instances\[type\].")
|
||||
|
||||
/atom/Del()
|
||||
// Pass to Destroy().
|
||||
if(!gc_destroyed)
|
||||
Destroy()
|
||||
|
||||
// Only call when we're actually deleted.
|
||||
DeleteFromProfiler()
|
||||
|
||||
..()
|
||||
|
||||
/atom/New()
|
||||
AddToProfiler()
|
||||
|
||||
|
||||
// Like Del(), but for qdel.
|
||||
// Called BEFORE qdel moves shit.
|
||||
/atom/proc/Destroy()
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//#define TESTING
|
||||
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31
|
||||
|
||||
// List of types and how many instances of each type there are.
|
||||
var/global/list/type_instances[0]
|
||||
|
||||
var/global/obj/effect/datacore/data_core = null
|
||||
var/global/obj/effect/overlay/plmaster = null
|
||||
var/global/obj/effect/overlay/slmaster = null
|
||||
|
||||
@@ -146,7 +146,8 @@ var/list/admin_verbs_debug = list(
|
||||
/client/proc/enable_debug_verbs,
|
||||
/client/proc/callproc,
|
||||
/client/proc/toggledebuglogs,
|
||||
/client/proc/qdel_toggle // /vg/
|
||||
/client/proc/qdel_toggle, // /vg/
|
||||
/client/proc/cmd_admin_dump_instances // /vg/
|
||||
)
|
||||
var/list/admin_verbs_possess = list(
|
||||
/proc/possess,
|
||||
|
||||
@@ -1110,3 +1110,17 @@ Pressure: [env.return_pressure()]"}
|
||||
log_admin("[key_name(src)] has toggled [M.key]'s [blockname] block [state]!")
|
||||
else
|
||||
alert("Invalid mob")
|
||||
|
||||
|
||||
/client/proc/cmd_admin_dump_instances()
|
||||
set category = "Debug"
|
||||
set name = "Dump Instance Counts"
|
||||
set desc = "MEMORY PROFILING IS TOO HIGH TECH"
|
||||
|
||||
var/F=file("instances.csv")
|
||||
fdel(F)
|
||||
F << "Types,Number of Instances"
|
||||
for(var/key in type_instances)
|
||||
F << "[key],[type_instances[key]]"
|
||||
|
||||
usr << "\blue Dumped to instances.csv."
|
||||
Reference in New Issue
Block a user