@@ 138-148 (lines=11) @@ | ||
135 | GlobalState::incr('timers.once.current'); |
|
136 | GlobalState::incr('timers.once.total'); |
|
137 | }); |
|
138 | $loop->on('timerTick', function ($_, $__, $timer) { |
|
139 | GlobalState::decr('timers.once.current'); |
|
140 | GlobalState::incr('timers.once.ticks'); |
|
141 | ||
142 | $hash = spl_object_hash($timer); |
|
143 | if (!isset($this->timers[$hash])) { |
|
144 | return; |
|
145 | } |
|
146 | ||
147 | unset($this->timers[$hash]); |
|
148 | }); |
|
149 | $loop->on('addPeriodicTimer', function ($_, $__, $timer) { |
|
150 | $this->timers[spl_object_hash($timer)] = true; |
|
151 | GlobalState::incr('timers.periodic.current'); |
|
@@ 157-171 (lines=15) @@ | ||
154 | $loop->on('periodicTimerTick', function () { |
|
155 | GlobalState::incr('timers.periodic.ticks'); |
|
156 | }); |
|
157 | $loop->on('cancelTimer', function (TimerInterface $timer) { |
|
158 | $hash = spl_object_hash($timer); |
|
159 | if (!isset($this->timers[$hash])) { |
|
160 | return; |
|
161 | } |
|
162 | ||
163 | unset($this->timers[$hash]); |
|
164 | ||
165 | if ($timer->isPeriodic()) { |
|
166 | GlobalState::decr('timers.periodic.current'); |
|
167 | return; |
|
168 | } |
|
169 | ||
170 | GlobalState::decr('timers.once.current'); |
|
171 | }); |
|
172 | } |
|
173 | ||
174 | protected function setupStreams(LoopDecorator $loop) |