--- Coro/Coro/State.xs 2007/09/29 19:42:10 1.171 +++ Coro/Coro/State.xs 2007/09/30 13:15:01 1.172 @@ -201,6 +201,9 @@ # include "state.h" #undef VAR + /* statistics */ + int usecount; /* number of switches to this coro */ + /* coro process data */ int prio; @@ -310,6 +313,9 @@ if (SvROK (coro)) coro = SvRV (coro); + if (SvTYPE (coro) != SVt_PVHV) + croak ("Coro::State object required"); + stash = SvSTASH (coro); if (stash != coro_stash && stash != coro_state_stash) { @@ -1016,6 +1022,8 @@ cctx_put (prev__cctx); } + ++next->usecount; + if (!next->cctx) next->cctx = cctx_get (aTHX); @@ -1555,7 +1563,7 @@ } } } - + SV * is_ready (Coro::State coro) PROTOTYPE: $ @@ -1612,8 +1620,14 @@ IV rss (Coro::State coro) PROTOTYPE: $ + ALIAS: + usecount = 1 CODE: - RETVAL = coro_rss (aTHX_ coro); + switch (ix) + { + case 0: RETVAL = coro_rss (aTHX_ coro); break; + case 1: RETVAL = coro->usecount; break; + } OUTPUT: RETVAL