mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
tokio: improve taskdump documentation (#5805)
- Add example trace output. - Add note on enabling unstable features. - Add note on performance overhead.
This commit is contained in:
parent
fb0d305a7a
commit
56c4365584
@ -406,9 +406,26 @@ cfg_taskdump! {
|
||||
/// # }
|
||||
/// ```
|
||||
///
|
||||
/// This produces highly detailed traces of tasks; e.g.:
|
||||
///
|
||||
/// ```plain
|
||||
/// TASK 0:
|
||||
/// ╼ dump::main::{{closure}}::a::{{closure}} at /tokio/examples/dump.rs:18:20
|
||||
/// └╼ dump::main::{{closure}}::b::{{closure}} at /tokio/examples/dump.rs:23:20
|
||||
/// └╼ dump::main::{{closure}}::c::{{closure}} at /tokio/examples/dump.rs:28:24
|
||||
/// └╼ tokio::sync::barrier::Barrier::wait::{{closure}} at /tokio/tokio/src/sync/barrier.rs:129:10
|
||||
/// └╼ <tokio::util::trace::InstrumentedAsyncOp<F> as core::future::future::Future>::poll at /tokio/tokio/src/util/trace.rs:77:46
|
||||
/// └╼ tokio::sync::barrier::Barrier::wait_internal::{{closure}} at /tokio/tokio/src/sync/barrier.rs:183:36
|
||||
/// └╼ tokio::sync::watch::Receiver<T>::changed::{{closure}} at /tokio/tokio/src/sync/watch.rs:604:55
|
||||
/// └╼ tokio::sync::watch::changed_impl::{{closure}} at /tokio/tokio/src/sync/watch.rs:755:18
|
||||
/// └╼ <tokio::sync::notify::Notified as core::future::future::Future>::poll at /tokio/tokio/src/sync/notify.rs:1103:9
|
||||
/// └╼ tokio::sync::notify::Notified::poll_notified at /tokio/tokio/src/sync/notify.rs:996:32
|
||||
/// ```
|
||||
///
|
||||
/// # Requirements
|
||||
///
|
||||
/// ## Debug Info Must Be Available
|
||||
///
|
||||
/// To produce task traces, the application must **not** be compiled
|
||||
/// with split debuginfo. On Linux, including debuginfo within the
|
||||
/// application binary is the (correct) default. You can further ensure
|
||||
@ -419,9 +436,30 @@ cfg_taskdump! {
|
||||
/// split-debuginfo = "off"
|
||||
/// ```
|
||||
///
|
||||
/// ## Unstable Features
|
||||
///
|
||||
/// This functionality is **unstable**, and requires both the
|
||||
/// `tokio_unstable` and `tokio_taskdump` cfg flags to be set.
|
||||
///
|
||||
/// You can do this by setting the `RUSTFLAGS` environment variable
|
||||
/// before invoking `cargo`; e.g.:
|
||||
/// ```bash
|
||||
/// RUSTFLAGS="--cfg tokio_unstable --cfg tokio_taskdump" cargo run --example dump
|
||||
/// ```
|
||||
///
|
||||
/// Or by [configuring][cargo-config] `rustflags` in
|
||||
/// `.cargo/config.toml`:
|
||||
/// ```text
|
||||
/// [build]
|
||||
/// rustflags = ["--cfg tokio_unstable", "--cfg tokio_taskdump"]
|
||||
/// ```
|
||||
///
|
||||
/// [cargo-config]:
|
||||
/// https://doc.rust-lang.org/cargo/reference/config.html
|
||||
///
|
||||
/// ## Platform Requirements
|
||||
///
|
||||
/// Task dumps are supported on Linux atop x86 and x86_64.
|
||||
/// Task dumps are supported on Linux atop aarch64, x86 and x86_64.
|
||||
///
|
||||
/// ## Current Thread Runtime Requirements
|
||||
///
|
||||
@ -431,6 +469,14 @@ cfg_taskdump! {
|
||||
///
|
||||
/// # Limitations
|
||||
///
|
||||
/// ## Performance
|
||||
///
|
||||
/// Although enabling the `tokio_taskdump` feature imposes virtually no
|
||||
/// additional runtime overhead, actually calling `Handle::dump` is
|
||||
/// expensive. The runtime must synchronize and pause its workers, then
|
||||
/// re-poll every task in a special tracing mode. Avoid requesting dumps
|
||||
/// often.
|
||||
///
|
||||
/// ## Local Executors
|
||||
///
|
||||
/// Tasks managed by local executors (e.g., `FuturesUnordered` and
|
||||
|
Loading…
x
Reference in New Issue
Block a user