MC subsystem tick overrun compensation (#2270)

Port of tgstation/tgstation#27196.

This PR makes the MC track how much a subsystem goes over its allotted tick limit and reduce how much of a tick it is allocated in later fires, as well as delaying later fires if the overrun is high enough.

Subsystems with SS_KEEP_TIMING will not be delayed due to overruns, but they will still get a reduced tick allocation.

Should lead to less tick-drift due to SSgarbage hard-deletions.
This commit is contained in:
Lohikar
2017-05-17 13:51:46 +03:00
committed by skull132
parent 6dea99eb64
commit c08922a181
3 changed files with 15 additions and 7 deletions
+2 -1
View File
@@ -21,6 +21,7 @@
var/next_fire = 0 //scheduled world.time for next fire()
var/cost = 0 //average time to execute
var/tick_usage = 0 //average tick usage
var/tick_overrun = 0 //average tick overrun
var/state = SS_IDLE //tracks the current state of the ss, running, paused, etc.
var/paused_ticks = 0 //ticks this ss is taking to run right now.
var/paused_tick_usage //total tick_usage of all of our runs while pausing this run
@@ -213,7 +214,7 @@
if (flags & SS_NO_FIRE)
. = "NO FIRE"
else if (can_fire && !suspended)
. = "[round(cost,1)]ms|[round(tick_usage,1)]%|[round(ticks,0.1)]"
. = "[round(cost,1)]ms|[round(tick_usage,1)]%([round(tick_overrun,1)]%)|[round(ticks,0.1)]"
else if (!can_fire)
. = "OFFLINE"
else