re-adding debug panel, adds more junk

This commit is contained in:
DragonTrance
2022-11-12 11:00:14 -05:00
parent 3d41e614a8
commit 5cf5407bb5
7 changed files with 104 additions and 8 deletions
+3 -2
View File
@@ -177,7 +177,8 @@ GLOBAL_LIST_INIT(admin_verbs_debug, world.AVerbsDebug())
/client/proc/cmd_display_overlay_log,
/client/proc/reload_configuration,
/datum/admins/proc/create_or_modify_area,
/client/proc/generate_wikichem_list //DO NOT PRESS UNLESS YOU WANT SUPERLAG
/client/proc/generate_wikichem_list, //DO NOT PRESS UNLESS YOU WANT SUPERLAG
/client/proc/check_timer_sources,
)
GLOBAL_PROTECT(admin_verbs_possess)
GLOBAL_LIST_INIT(admin_verbs_possess, list(/proc/possess, /proc/release))
@@ -728,4 +729,4 @@ GLOBAL_LIST_INIT(admin_verbs_hideable, list(
set name = "Debug Stat Panel"
set category = "Debug"
src << output("", "statbrowser:create_debug")
src << output("", "statbrowser:create_debug")
+79
View File
@@ -822,3 +822,82 @@
return
if(alert(usr, "Are you absolutely sure you want to reload the configuration from the default path on the disk, wiping any in-round modificatoins?", "Really reset?", "No", "Yes") == "Yes")
config.admin_reload()
/// A debug verb to check the sources of currently running timers
/client/proc/check_timer_sources()
set category = "Debug"
set name = "Check Timer Sources"
set desc = "Checks the sources of the running timers"
if(!check_rights(R_DEBUG))
return
var/bucket_list_output = generate_timer_source_output(SStimer.bucket_list)
var/second_queue = generate_timer_source_output(SStimer.second_queue)
usr << browse({"
<b>Bucket: [SStimer.bucket_count]</b> | <b>Secondary: [length(SStimer.second_queue)]</b> | <b>Resets: [SStimer.bucket_total_resets]</b>
<br>
<h3>Bucket List</h3>
[bucket_list_output]
<h3>Second Queue</h3>
[second_queue]
"}, "window=check_timer_sources;size=700x700")
/proc/generate_timer_source_output(list/datum/timedevent/events)
var/list/per_source = list()
var/list/per_source_min_time = list()
// Collate all events and figure out what sources are creating the most
for (var/_event in events)
if (!_event)
continue
var/datum/timedevent/event = _event
do
var/source = "NO SOURCE"
if (event.source)
source = event.source
if (per_source[source] == null)
per_source[source] = 1
else
per_source[source]++
if(per_source_min_time[source] == null)
per_source_min_time[source] = event.timeToRun + event.wait - world.time
else
per_source_min_time[source] = min(per_source_min_time[source], event.timeToRun + event.wait - world.time)
event = event.next
while (event && event != _event)
// Now, sort them in order
var/list/sorted = list()
for (var/source in per_source)
sorted += list(list("source" = source, "count" = per_source[source], "time" = per_source_min_time[source]))
sorted = sortTim(sorted, .proc/cmp_timer_data)
// Now that everything is sorted, compile them into an HTML output
var/output = {"
<table border='1'>
<tr width='100%'>
<td width='80%'><b>File Source && Line</b></td>
<td width='20%'>Min TimeToFire</td>
<td>C</td>
</tr>
"}
for (var/_timer_data in sorted)
var/list/timer_data = _timer_data
output += {"<tr>
<td><b>[timer_data["source"]]</b></td>
<td>[timer_data["time"]]</td>
<td>[timer_data["count"]]</td>
</tr>"}
output += "</table>"
return output
/proc/cmp_timer_data(list/a, list/b)
return b["count"] - a["count"]