Skip to content

Commit

Permalink
profiler (#457)
Browse files Browse the repository at this point in the history
  • Loading branch information
homexp13 authored Sep 28, 2024
1 parent 6dacade commit 5243c5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/controllers/master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,16 @@ GLOBAL_REAL(Master, /datum/controller/master)

queue_node.state = SS_RUNNING

if(queue_node.profiler_focused)
world.Profile(PROFILE_START)

tick_usage = TICK_USAGE
var/state = queue_node.ignite(queue_node_paused)
tick_usage = TICK_USAGE - tick_usage

if(queue_node.profiler_focused)
world.Profile(PROFILE_STOP)

if (state == SS_RUNNING)
state = SS_IDLE
current_tick_budget -= queue_node_priority
Expand Down
6 changes: 6 additions & 0 deletions code/controllers/subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
///Bitmap of what game states can this subsystem fire at. See [RUNLEVELS_DEFAULT] for more details.
var/runlevels = RUNLEVELS_DEFAULT //points of the game at which the SS can fire

/**
* boolean set by admins. if TRUE then this subsystem will stop the world profiler after ignite() returns and start it again when called.
* used so that you can audit a specific subsystem or group of subsystems' synchronous call chain.
*/
var/profiler_focused = FALSE

// Bookkeeping variables; probably shouldn't mess with these.

///last world.time we called fire()
Expand Down

0 comments on commit 5243c5c

Please sign in to comment.