mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 20:48:56 +01:00
[MIRROR] Saves profiler snapshots every 5 minutes (#27875)
* Saves profiler snapshots every 5 minutes (#83467) ## About The Pull Request As the title says. Each saved snapshot will be named - `profiler-[TIME IN SECONDS].json` - `sendmaps-[TIME IN SECONDS].json` For example, `profiler-0.json`, `profiler-300.json`, `profiler-600.json` would correspond to a profile at the start of the round, a profile 300 seconds into a round and a profile 600 seconds into a round. The timings depend on world.time, so it's probably not a good idea to rely on these timings to stay consistent. ## Why It's Good For The Game Allows us to track performance of procs over time. Could allow us to spot any sort of anomalies or performance sinks. CC: @ MrStonedOne @ bobbah @ LemonInTheDark --------- Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> * Saves profiler snapshots every 5 minutes --------- Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>
This commit is contained in:
co-authored by
Watermelon914
Watermelon914
parent
870307d3f3
commit
f3d9c4433f
@@ -1,11 +1,8 @@
|
||||
#define PROFILER_FILENAME "profiler.json"
|
||||
#define SENDMAPS_FILENAME "sendmaps.json"
|
||||
|
||||
SUBSYSTEM_DEF(profiler)
|
||||
name = "Profiler"
|
||||
init_order = INIT_ORDER_PROFILER
|
||||
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
|
||||
wait = 3000
|
||||
wait = 300 SECONDS
|
||||
var/fetch_cost = 0
|
||||
var/write_cost = 0
|
||||
|
||||
@@ -56,12 +53,12 @@ SUBSYSTEM_DEF(profiler)
|
||||
|
||||
if(!length(current_profile_data)) //Would be nice to have explicit proc to check this
|
||||
stack_trace("Warning, profiling stopped manually before dump.")
|
||||
var/prof_file = file("[GLOB.log_directory]/[PROFILER_FILENAME]")
|
||||
var/prof_file = file("[GLOB.log_directory]/profiler/profiler-[round(world.time * 0.1, 10)].json")
|
||||
if(fexists(prof_file))
|
||||
fdel(prof_file)
|
||||
if(!length(current_sendmaps_data)) //Would be nice to have explicit proc to check this
|
||||
stack_trace("Warning, sendmaps profiling stopped manually before dump.")
|
||||
var/sendmaps_file = file("[GLOB.log_directory]/[SENDMAPS_FILENAME]")
|
||||
var/sendmaps_file = file("[GLOB.log_directory]/profiler/sendmaps-[round(world.time * 0.1, 10)].json")
|
||||
if(fexists(sendmaps_file))
|
||||
fdel(sendmaps_file)
|
||||
|
||||
@@ -70,5 +67,3 @@ SUBSYSTEM_DEF(profiler)
|
||||
WRITE_FILE(sendmaps_file, current_sendmaps_data)
|
||||
write_cost = MC_AVERAGE(write_cost, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
|
||||
|
||||
#undef PROFILER_FILENAME
|
||||
#undef SENDMAPS_FILENAME
|
||||
|
||||
Reference in New Issue
Block a user