… | |
… | |
334 | default being C<4>. |
334 | default being C<4>. |
335 | |
335 | |
336 | =item @states = Coro::State::list |
336 | =item @states = Coro::State::list |
337 | |
337 | |
338 | Returns a list of all states currently allocated. |
338 | Returns a list of all states currently allocated. |
|
|
339 | |
|
|
340 | =item $was_enabled = Coro::State::enable_times [$enable] |
|
|
341 | |
|
|
342 | Enables/disables/queries the current state of per-thread real and |
|
|
343 | cpu-time gathering. |
|
|
344 | |
|
|
345 | When enabled, the real time and the cpu time (user + system time) |
|
|
346 | spent in each thread is accumulated. If disabled, then the accumulated |
|
|
347 | times will stay as they are (they start at 0). |
|
|
348 | |
|
|
349 | Currently, cpu time is only measured on GNU/Linux systems, all other |
|
|
350 | systems only gather real time. |
|
|
351 | |
|
|
352 | Enabling time profiling slows down thread switching by a factor of 2 to |
|
|
353 | 10, depending on platform on hardware. |
|
|
354 | |
|
|
355 | The times will be displayed when running C<Coro::Debug::command "ps">, and |
|
|
356 | cna be queried by calling C<< $state->times >>. |
|
|
357 | |
|
|
358 | =item ($real, $cpu) = $state->times |
|
|
359 | |
|
|
360 | Returns the real time and cpu times spent in the given C<$state>. See |
|
|
361 | C<Coro::State::enable_times> for more info. |
339 | |
362 | |
340 | =item $clone = $state->clone |
363 | =item $clone = $state->clone |
341 | |
364 | |
342 | This exciting method takes a Coro::State object and clones it, i.e., it |
365 | This exciting method takes a Coro::State object and clones it, i.e., it |
343 | creates a copy. This makes it possible to restore a state more than once, |
366 | creates a copy. This makes it possible to restore a state more than once, |