mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 11:36:24 +01:00
byond-tracy additions and refactors (#87067)
## About The Pull Request This adds plenty of useful stuff regarding byond-tracy, altho mostly focused on the [Paradise fork](https://github.com/ParadiseSS13/byond-tracy). - Adds two new config options **(THEY ARE DISABLED BY DEFAULT)** - `ALLOW_TRACY_START` gives admins with +DEBUG the "Run Tracy Now" verb, which will allow them to start profiling with byond-tracy mid-round. - `ALLOW_TRACY_QUEUE` gives admins with +DEBUG the "Toggle Tracy Next Round" verb, which will initialize byond-tracy during world init the next round (in the same way as passing `-params tracy` or defining `USE_BYOND_TRACY`) - If byond-tracy fails to initialize, the error will be logged and available to view for the whole round. - If `MC_TAB_TRACY_INFO` is defined, information about byond-tracy now appears in the MC tab - if it's running or not, if it errored (and what the error is), why it's running, if its queued for next round, etc. - byond-tracy is now properly shut down when the world shuts down/reboots, minimizing the risk of data loss or crashing - More info regarding byond-tracy init is sent to `world.log` ## Why It's Good For The Game Profiling is super helpful, and this should make things quite easier ## Changelog No user-facing changes
This commit is contained in:
@@ -852,3 +852,42 @@ ADMIN_VERB(check_missing_sprites, R_DEBUG, "Debug Worn Item Sprites", "We're can
|
||||
actual_file_name = 'icons/mob/clothing/belt_mirror.dmi'
|
||||
if(!(sprite.icon_state in icon_states(actual_file_name)))
|
||||
to_chat(user, span_warning("ERROR sprites for [sprite.type]. Suit Storage slot."), confidential = TRUE)
|
||||
|
||||
#ifndef OPENDREAM
|
||||
ADMIN_VERB(start_tracy, R_DEBUG, "Run Tracy Now", "Start running the byond-tracy profiler immediately", ADMIN_CATEGORY_DEBUG)
|
||||
if(GLOB.tracy_initialized)
|
||||
to_chat(user, span_warning("byond-tracy is already running!"), avoid_highlighting = TRUE, type = MESSAGE_TYPE_DEBUG, confidential = TRUE)
|
||||
return
|
||||
else if(GLOB.tracy_init_error)
|
||||
to_chat(user, span_danger("byond-tracy failed to initialize during an earlier attempt: [GLOB.tracy_init_error]"), avoid_highlighting = TRUE, type = MESSAGE_TYPE_DEBUG, confidential = TRUE)
|
||||
return
|
||||
message_admins(span_adminnotice("[key_name_admin(user)] is trying to start the byond-tracy profiler."))
|
||||
log_admin("[key_name(user)] is trying to start the byond-tracy profiler.")
|
||||
GLOB.tracy_initialized = FALSE
|
||||
GLOB.tracy_init_reason = "[user.ckey]"
|
||||
world.init_byond_tracy()
|
||||
if(GLOB.tracy_init_error)
|
||||
to_chat(user, span_danger("byond-tracy failed to initialize: [GLOB.tracy_init_error]"), avoid_highlighting = TRUE, type = MESSAGE_TYPE_DEBUG, confidential = TRUE)
|
||||
message_admins(span_adminnotice("[key_name_admin(user)] tried to start the byond-tracy profiler, but it failed to initialize ([GLOB.tracy_init_error])"))
|
||||
log_admin("[key_name(user)] tried to start the byond-tracy profiler, but it failed to initialize ([GLOB.tracy_init_error])")
|
||||
return
|
||||
to_chat(user, span_notice("byond-tracy successfully started!"), avoid_highlighting = TRUE, type = MESSAGE_TYPE_DEBUG, confidential = TRUE)
|
||||
message_admins(span_adminnotice("[key_name_admin(user)] started the byond-tracy profiler."))
|
||||
log_admin("[key_name(user)] started the byond-tracy profiler.")
|
||||
if(GLOB.tracy_log)
|
||||
rustg_file_write("[GLOB.tracy_log]", "[GLOB.log_directory]/tracy.loc")
|
||||
|
||||
ADMIN_VERB_CUSTOM_EXIST_CHECK(start_tracy)
|
||||
return CONFIG_GET(flag/allow_tracy_start) && fexists(TRACY_DLL_PATH)
|
||||
|
||||
ADMIN_VERB(queue_tracy, R_DEBUG, "Toggle Tracy Next Round", "Toggle running the byond-tracy profiler next round", ADMIN_CATEGORY_DEBUG)
|
||||
if(fexists(TRACY_ENABLE_PATH))
|
||||
fdel(TRACY_ENABLE_PATH)
|
||||
else
|
||||
rustg_file_write("[user.ckey]", TRACY_ENABLE_PATH)
|
||||
message_admins(span_adminnotice("[key_name_admin(user)] [fexists(TRACY_ENABLE_PATH) ? "enabled" : "disabled"] the byond-tracy profiler for next round."))
|
||||
log_admin("[key_name(user)] [fexists(TRACY_ENABLE_PATH) ? "enabled" : "disabled"] the byond-tracy profiler for next round.")
|
||||
|
||||
ADMIN_VERB_CUSTOM_EXIST_CHECK(queue_tracy)
|
||||
return CONFIG_GET(flag/allow_tracy_queue) && fexists(TRACY_DLL_PATH)
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user