You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: emit and show self-wake counts for tasks (console-rs#112)
This counts all wakes of a task that happen while the task is "currently
polled". This could be from `task::yield_now()`, from `tokio::coop`, or
any other pattern that triggers the task to wake even though it's
currently being polled.
This implementation builds upon @seanmonstar's branch console-rs#55. However,
rather than detecting self-wakes by simply looking at _whether_ the task
is being polled at all, we instead detect them by checking whether the
task's span is on the current thread's stack of entered spans. This
approach should _not_ produce self-positives when a task is woken by
another thread while it is currently entered (as discussed in
tokio-rs/console#55 (comment)).
Testing this with the "burn" subcommand for the example app, which
spawns one task that does a lot of self-wakes via `task::yield`,
indicates that it is, in fact, working properly. Here are the stats for the
`burn` task:

Note the very large number of self-wakes.
In comparison, here are the task stats for a "normal" task, which does
not wake itself (and is instead woken by timers):

Note that no self-wakes stat is displayed.
Closesconsole-rs#55.
Signed-off-by: Eliza Weisman <[email protected]>
Co-authored-by: Sean McArthur <[email protected]>
0 commit comments