Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tokio-console/src/state/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ impl Task {
self.stats.last_wake > self.stats.last_poll_started
}

pub(crate) fn is_blocking(&self) -> bool {
matches!(self.kind.as_ref(), "block_on" | "blocking")
}

pub(crate) fn is_completed(&self) -> bool {
self.stats.total.is_some()
}
Expand Down
12 changes: 12 additions & 0 deletions tokio-console/src/warnings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ impl Warn<Task> for SelfWakePercent {
}

fn check(&self, task: &Task) -> Warning {
// Don't fire warning for tasks that are not async
if task.is_blocking() {
return Warning::Ok;
}
let self_wakes = task.self_wake_percent();
if self_wakes > self.min_percent {
Warning::Warn
Expand All @@ -174,6 +178,10 @@ impl Warn<Task> for LostWaker {
}

fn check(&self, task: &Task) -> Warning {
// Don't fire warning for tasks that are not async
if task.is_blocking() {
return Warning::Ok;
}
if !task.is_completed()
&& task.waker_count() == 0
&& !task.is_running()
Expand Down Expand Up @@ -222,6 +230,10 @@ impl Warn<Task> for NeverYielded {
}

fn check(&self, task: &Task) -> Warning {
// Don't fire warning for tasks that are not async
if task.is_blocking() {
return Warning::Ok;
}
// Don't fire warning for tasks that are waiting to run
if task.state() != TaskState::Running {
return Warning::Ok;
Expand Down