forked from tokio-rs/tokio
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tracing: instrument time::Sleep (tokio-rs#4072)
This branch instruments the `Sleep` resource to allow the tokio-console to consume data about resources usage. The corresponding console branch is here: tokio-rs/console#77 Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
- Loading branch information
1 parent
9aeb541
commit 2f10c55
Showing
5 changed files
with
199 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
cfg_trace! { | ||
macro_rules! trace_op { | ||
($name:literal, $readiness:literal, $parent:expr) => { | ||
tracing::trace!( | ||
target: "runtime::resource::poll_op", | ||
parent: $parent, | ||
op_name = $name, | ||
is_ready = $readiness | ||
); | ||
} | ||
} | ||
|
||
macro_rules! trace_poll_op { | ||
($name:literal, $poll:expr, $parent:expr $(,)*) => { | ||
match $poll { | ||
std::task::Poll::Ready(t) => { | ||
trace_op!($name, true, $parent); | ||
std::task::Poll::Ready(t) | ||
} | ||
std::task::Poll::Pending => { | ||
trace_op!($name, false, $parent); | ||
return std::task::Poll::Pending; | ||
} | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters