mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
Ports /tg controller optimizations
https://github.com/tgstation/tgstation/pull/31092 - Fixes subsystems not returning a qdel hint https://github.com/tgstation/tgstation/pull/31494 - In which the stoner one gets stoned and tries to address tick contention... again https://github.com/tgstation/tgstation/pull/31950 - Removes an empty New() https://github.com/tgstation/tgstation/pull/31951 - Logs subsystem shutdowns
This commit is contained in:
@@ -13,6 +13,12 @@
|
||||
#define TimeOfGame (get_game_time())
|
||||
#define TimeOfTick (TICK_USAGE*0.01*world.tick_lag)
|
||||
|
||||
#define TICK *world.tick_lag
|
||||
#define TICKS *world.tick_lag
|
||||
|
||||
#define DS2TICKS(DS) (DS/world.tick_lag) // Convert deciseconds to ticks
|
||||
#define TICKS2DS(T) (T TICKS) // Convert ticks to deciseconds
|
||||
|
||||
/proc/get_game_time()
|
||||
var/global/time_offset = 0
|
||||
var/global/last_time = 0
|
||||
@@ -111,13 +117,21 @@ var/round_start_time = 0
|
||||
|
||||
//Increases delay as the server gets more overloaded,
|
||||
//as sleeps aren't cheap and sleeping only to wake up and sleep again is wasteful
|
||||
#define DELTA_CALC max(((max(TICK_USAGE, world.cpu) / 100) * max(Master.sleep_delta,1)), 1)
|
||||
#define DELTA_CALC max(((max(TICK_USAGE, world.cpu) / 100) * max(Master.sleep_delta-1,1)), 1)
|
||||
|
||||
/proc/stoplag()
|
||||
//returns the number of ticks slept
|
||||
/proc/stoplag(initial_delay)
|
||||
if (!Master || !(Master.current_runlevel & RUNLEVELS_DEFAULT))
|
||||
sleep(world.tick_lag)
|
||||
return 1
|
||||
if (!initial_delay)
|
||||
initial_delay = world.tick_lag
|
||||
. = 0
|
||||
var/i = 1
|
||||
var/i = DS2TICKS(initial_delay)
|
||||
do
|
||||
. += round(i*DELTA_CALC)
|
||||
. += CEILING(i*DELTA_CALC, 1)
|
||||
sleep(i*world.tick_lag*DELTA_CALC)
|
||||
i *= 2
|
||||
while (TICK_USAGE > min(TICK_LIMIT_TO_RUN, Master.current_ticklimit))
|
||||
|
||||
#undef DELTA_CALC
|
||||
Reference in New Issue
Block a user