Sha256: 997ba0339af84ef878881fdb6f35d8f6b39dc81e8f0b5cafce94476d50675c91

Contents?: true

Size: 1.15 KB

Versions: 25

Compression:

Stored size: 1.15 KB

Contents

use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed};

/// Retrieves metrics from the Tokio runtime.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1.x releases. See [the documentation on unstable
/// features][unstable] for details.
///
/// [unstable]: crate#unstable-features
#[derive(Debug)]
pub(crate) struct SchedulerMetrics {
    /// Number of tasks that are scheduled from outside the runtime.
    pub(super) remote_schedule_count: AtomicU64,
    pub(super) budget_forced_yield_count: AtomicU64,
}

impl SchedulerMetrics {
    pub(crate) fn new() -> SchedulerMetrics {
        SchedulerMetrics {
            remote_schedule_count: AtomicU64::new(0),
            budget_forced_yield_count: AtomicU64::new(0),
        }
    }

    /// Increment the number of tasks scheduled externally
    pub(crate) fn inc_remote_schedule_count(&self) {
        self.remote_schedule_count.fetch_add(1, Relaxed);
    }

    /// Increment the number of tasks forced to yield due to budget exhaustion
    pub(crate) fn inc_budget_forced_yield_count(&self) {
        self.budget_forced_yield_count.fetch_add(1, Relaxed);
    }
}

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
wasmtime-23.0.2 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/metrics/scheduler.rs
wasmtime-22.0.0 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/metrics/scheduler.rs
wasmtime-21.0.1 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/metrics/scheduler.rs
wasmtime-20.0.2 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/metrics/scheduler.rs
wasmtime-20.0.0 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/metrics/scheduler.rs
wasmtime-18.0.3 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/metrics/scheduler.rs
wasmtime-17.0.1 ./ext/cargo-vendor/tokio-1.35.1/src/runtime/metrics/scheduler.rs
wasmtime-17.0.0 ./ext/cargo-vendor/tokio-1.35.1/src/runtime/metrics/scheduler.rs
wasmtime-16.0.0 ./ext/cargo-vendor/tokio-1.35.1/src/runtime/metrics/scheduler.rs
wasmtime-15.0.1 ./ext/cargo-vendor/tokio-1.35.1/src/runtime/metrics/scheduler.rs
wasmtime-15.0.0 ./ext/cargo-vendor/tokio-1.35.1/src/runtime/metrics/scheduler.rs
wasmtime-14.0.4 ./ext/cargo-vendor/tokio-1.33.0/src/runtime/metrics/scheduler.rs
wasmtime-14.0.3 ./ext/cargo-vendor/tokio-1.33.0/src/runtime/metrics/scheduler.rs
wasmtime-14.0.1 ./ext/cargo-vendor/tokio-1.33.0/src/runtime/metrics/scheduler.rs
wasmtime-14.0.0 ./ext/cargo-vendor/tokio-1.33.0/src/runtime/metrics/scheduler.rs
wasmtime-13.0.0 ./ext/cargo-vendor/tokio-1.32.0/src/runtime/metrics/scheduler.rs
wasmtime-12.0.1 ./ext/cargo-vendor/tokio-1.32.0/src/runtime/metrics/scheduler.rs
wasmtime-12.0.0 ./ext/cargo-vendor/tokio-1.32.0/src/runtime/metrics/scheduler.rs
wasmtime-11.0.0 ./ext/cargo-vendor/tokio-1.32.0/src/runtime/metrics/scheduler.rs
wasmtime-10.0.1 ./ext/cargo-vendor/tokio-1.30.0/src/runtime/metrics/scheduler.rs