Files
fulpstation/code/__HELPERS/stat_tracking.dm
Kyle Spier-Swenson d7b537ce24 SSoverlay improvements and tweaks (#32371)
* Overlay per-type cost logging.

Overlays will now log how long each type took to process.

Changed up how overlays was done to account for the fact its a queue and not a processor. (it was using almost none of the processing subsystem framework)

Made the overlay loop faster by making it not cut the list until the end.

Added a simple generic benchmark stat tracking system.

I don't know how much overhead this adds to overlays. i may put it behind testing or something, but i do want to test this on the serbers to get some stats.

* Removes flush() as it was creating race conditions

* Use ref

* text2file

* Atoms added as an overlay will have their pending overlays compiled before being converted to an appearance
2017-11-10 20:25:29 +01:00

14 lines
499 B
Plaintext

/proc/render_stats(list/stats, user, sort = /proc/cmp_generic_stat_item_time)
sortTim(stats, sort, TRUE)
var/list/lines = list()
for (var/entry in stats)
var/list/data = stats[entry]
lines += "[entry] => [num2text(data[STAT_ENTRY_TIME], 10)]ms ([data[STAT_ENTRY_COUNT]]) (avg:[num2text(data[STAT_ENTRY_TIME]/(data[STAT_ENTRY_COUNT] || 1), 99)])"
if (user)
user << browse("<ol><li>[lines.Join("</li><li>")]</li></ol>", "window=[url_encode("stats:[REF(stats)]")]")
. = lines.Join("\n")