Commit Graph

72 Commits

Author SHA1 Message Date
Kyle Spier-Swenson
ffd601a781 Fixes timer bug (again) (maybe) (blame byond) (this is why arrays should start at 0) (#40947)
* Fixes timer bug (again) (maybe) (blame byond) (this is why arrays should start at 0)

* missed a spot
2018-10-22 08:39:51 +13:00
ninjanomnom
38fa012b25 Fixes looping client time timers 2018-10-18 16:12:07 -04:00
Kyle Spier-Swenson
c3d08e4b64 Makes timer watchdog logic Fitter, Happier, More Productive 2018-09-22 11:35:39 -07:00
ninjanomnom
01a79dccb0 Fixes timer buckets going into negatives and adds a regression test 2018-08-16 14:50:09 -04:00
ninjanomnom
863cd2d57e Fixes TIMER_CLIENT_TIME looping timers not adding their wait 2018-07-12 20:23:56 -04:00
ninjanomnom
bb6b09d3e1 Fixes the active timer count getting out of sync when buckets reset while spent timers were awaiting qdeletion
Co-authored-by: Kyle Spier-Swenson <kyleshome@gmail.com>
2018-07-12 20:23:56 -04:00
ninjanomnom
d32d2869c0 Adds looping timers
and a requested binary search insert macro
2018-07-12 20:23:56 -04:00
Kyle Spier-Swenson
ff77dac694 Fix timer bug (#38994) 2018-07-09 16:11:51 +03:00
Jordan Brown
8b16aaf87e Adds a warning for using TIMER_OVERRIDE without TIMER_UNIQUE 2018-06-28 14:37:28 -04:00
Jordan Brown
9549949eeb Merge pull request #38008 from MrStonedOne/ISawSSTimerFloatingInMyDreams
Fixes some edge cases in sstimer that could cause a timer to run before it was expecting to.
2018-05-25 11:51:03 -04:00
MrStonedOne
8b7694a9fc Timers on qdeleted objects is no longer supported.
Before we only warned if the wait was 1 or higher to solve issues with objects settings timers on themselves while getting qdeleted, a common enough usecase to support (even if it is annoying), but then I remembered we could check for qdestroying directly.

Also fixes it so such `destory()` time timers actually run consistantly. before they would only work if called after the `..()` in `destroy()`
2018-05-22 21:06:51 -07:00
MrStonedOne
01d816fa2e Fixes some edge cases in sstimer that could cause a timer to run before it was expecting to.
Because sstimer tracks timers internally in the terms of what "byond tick" they are suppose to run at; float wait values are now rounded *up* to the next Byond Tick rather then have byond round the resulting list index *down* at access time.

0 wait timers are now rounded *up* to `world.tick_lag` to avoid incompabilities with editing the current tick's bucket while it was being processed.
2018-05-22 20:27:39 -07:00
ShizCalev
3e32a82363 Corrects addtime stack_trace typo 2018-01-22 03:46:31 -05:00
Kyle Spier-Swenson
e31b2f749b Makes stoppable timers faster. (#34208)
* Makes stoppable timers faster.

* Missed a spot
2018-01-11 04:54:07 -05:00
kevinz000
02254279fb Adds jousting (#33531) 2017-12-18 20:55:09 -06:00
Kyle Spier-Swenson
fdcf747e18 [ready]Timer queuing tweaks: binary sorted inserts and rolling buckets. (#33098)
* Timer queuing tweaks: binary sorted inserts and rolling buckets.

Client time timers now uses a binary search algorithm for its sorted inserts.

Processing now uses a binary sorted insert, rather then sorting it with sortTim during bucket_shifts.

Buckets now automatically wrap around rather then get regenerated every minute. (Rolling queue)

* Fixes some queue management bugs.

* Fixes a Order of Operations goof up in the ticks<->ds macros.

@ninjanomnom your pain is my success

* Remove debug line

* Fixes some binary insert bugs, fixes client time timers, moved id over to GUID

* Fixes initialization-time timers fucking everything up
2017-12-08 22:02:34 +01:00
jammer312
bc998ffe1a Crash to timers and INFINITY check to beams. (#33219)
* beams

* timers

* >= instead of !=

* whooops
2017-12-03 13:44:58 -05:00
AnturK
c12a969c60 I shouldn't be doing this without performance report on below 300 elements because this shit is just ugly. 2017-11-14 19:39:01 +01:00
AnturK
d6f780613c Fixes client timers. 2017-11-13 20:54:58 +01:00
Emmett Gaines
825ab4def4 [512] The great \ref purge (#31824)
* The great \ref purge

* cleanup
2017-10-28 17:20:04 -04:00
Kyle Spier-Swenson
2b86b39747 More timer debugging for the debug gods. (#30436)
* More timer debugging for the debug gods.

* Its times like this I wish I could amend commit from the web interface

* git commit -a -amend&&git push --force
2017-09-07 10:58:22 -04:00
Jordan Brown
cd912faf59 Unifies datum definitions 2017-08-01 15:51:26 -04:00
pigeons
4e05dd63f9 Fixes timer id collision (#29437)
The list of active timers timer_id_dict identifies timers by their numerical id as a string. However this was done using embedded expressions inside the string, which calls num2text with a default of 6 significant figures. This means anything at or above 1 million is expressed in scientific notation.

"timer[1000000]" -> "timer1e+06"
"timer[1000001]" -> "timer1e+06"

Calling num2text manually with 8 significant figures kicks the collision problem down the road to 2^24 (16 million).

nextid is now selectively incremented and is looped back to 1 when reaching the 2^24 threshold.
Also now includes collision checking.
2017-07-26 11:48:21 +12:00
Kyle Spier-Swenson
eeab8f71bb Make timer debug info more robust (#29100)
* Make timer debug info more robust

* Update timer.dm

* Update timer.dm

* Update timer.dm

* Update timer.dm

* Update timer.dm

* Update timer.dm

* Update timer.dm
2017-07-07 22:18:44 -04:00
Jordan Brown
a8dffe5eb2 Adds warning for misuse of deltimer 2017-06-14 16:07:29 -04:00
Cyberboss
a0a27219b6 MC Runlevels 2017-05-10 16:05:37 -04:00
Jack Edge
a76d4374c1 Moves init_order to defines, moves SSevents above ticker. 2017-04-22 22:08:31 +01:00
Cyberboss
9c9673fe45 Adds a crash log and recovery for hanging SStimer 2017-04-03 19:47:42 -04:00
Cyberboss
fb596bcdb3 _DEF 2017-03-22 14:52:21 -04:00
Cyberboss
7e14ec75fc Normalizes subsystem definitions 2017-03-22 11:50:46 -04:00
kevinz000
51d3cd11f5 [READY]Refactors beams to use timers for recalculation, and new beam proc after drawing (#25252)
* now with timers!

* woops

* hmm this is better

* stoppable timers

* more timer stuff

* fix

* fix
2017-03-22 22:19:16 +13:00
Cyberboss
31ee152489 Repaths subsystem to controller/subsystem (#24624)
* Repaths subsystem to controller/subsystem

* Fix the shit
2017-03-08 22:05:45 +01:00
Cyberboss
4d78f4e3d4 Somehow missed timer 2017-03-02 16:24:10 -05:00
Cyberboss
ec8c42bbff Sorted client time timers 2017-02-21 09:46:50 -05:00
oranges
edebf05394 Merge pull request #24114 from Cyberboss/addtimerflag
Adds option of unique timers ignoring wait
2017-02-17 14:32:12 +13:00
Cyberboss
e806fcd11c Adds option of unique timers ignoring wait 2017-02-14 14:04:13 -05:00
Cyberboss
29bbb4d529 Makes a thing use a better define 2017-02-13 16:23:15 -05:00
Cyberboss
3fc6c07825 Makes addtimer(..., 0) more akin to spawn(0) (#23669)
* Makes addtimer(..., 0) use spawn(0)

* Jess queue it

* No negative times
2017-02-06 10:23:45 +13:00
Cyberboss
b86e224571 Makes qdeleted and qdestroying macros (#23666)
* Makes qdeleted and qdestroying macros

* Makes QDELETED and QDESTROYING uppercase

* Swap qdel checks istype's for != null's

* Fix it

* How was this missed?
2017-02-06 00:59:27 +13:00
Kyle Spier-Swenson
068eb07473 Fixes freon/ice causing lag (#23493)
* Fixes freon causing lag

Yes, these were stacking. so a turf would have a bunch of "handle wet" timers running on it, every 1.5 seconds, all checking the same shit.

* Fixes unique timers
2017-02-03 10:28:14 +13:00
MrStonedOne
dbb4623440 Cleans up timer handling. 2017-01-30 03:38:13 -08:00
MrStonedOne
aad8724558 This is better (proper resuming support) 2017-01-24 15:38:48 -08:00
Kyle Spier-Swenson
9f2374f220 Fix warning 2017-01-23 00:34:50 -08:00
Kyle Spier-Swenson
96aa691d9a Makes the timer subsystem less chinsky at the cost of performance
Making timers run thru qdel will be a cost a pretty fair chunk of resources, and will very likely flood the qdel controller, but it should do for now until i figure out why they randomly decide to stop qdeling.

Also, changes the only thing i think could be an issue causing references to not get cleaned up to be less lean and more forgiving.

I'll revisit this at some point and see if i can't figure this out.
2017-01-22 23:00:39 -08:00
Kyle Spier-Swenson
32c8e178bf Fixes timers not GCing 2017-01-21 20:00:46 -08:00
Kyle Spier-Swenson
c341178ff4 Fixes bug with addtimer keeping old timers around, makes addtimer even faster. (#23126)
* Fixes timers being left around, Makes addtimer() sanic fast.

This adds a new flag, TIMER_STOPPABLE. Most(80%) of the overhead for addtimer() was in adding the timer to the associated lookup list for deltimer() to use. Moving that functionality to a flag so it wouldn't slow down the 70% of things calling timers puts the final nail in the coffin of byond's sleep/spawn().

spawn: 324 seconds across 5,948,372 calls

addtimer: 67 seconds across 5,953,220 calls

The testing setup for profiling was included in this commit, it will be removed in a later commit. @Fox-McCloud

* Remove profiling procs.

* fix runtime

luckly when this happened, we were about to resume anyways.
2017-01-20 09:31:50 +01:00
MrStonedOne
01e8fc6fbc Fixes timers cleaning up oddly in certain edge cases. 2017-01-17 00:12:29 -08:00
MrStonedOne
c8d4ed5cfd Some more improvements and overhead shaving. 2017-01-16 12:56:48 -08:00
MrStonedOne
15e69deadc Remove a debug line and reword a crash 2017-01-16 12:56:48 -08:00
MrStonedOne
3f75fdb42d Addtimer refactor: Officially faster then byond's internal sleep system 2017-01-16 12:56:48 -08:00