Sha256: e5a6a1a1d01a50890dabbeb7998c7b64a954ed94bbb7cf9505ff917ed63633f6

Contents?: true

Size: 1.96 KB

Versions: 30

Compression:

Stored size: 1.96 KB

Contents

#[cfg(tokio_internal_mt_counters)]
mod imp {
    use std::sync::atomic::AtomicUsize;
    use std::sync::atomic::Ordering::Relaxed;

    static NUM_MAINTENANCE: AtomicUsize = AtomicUsize::new(0);
    static NUM_NOTIFY_LOCAL: AtomicUsize = AtomicUsize::new(0);
    static NUM_UNPARKS_LOCAL: AtomicUsize = AtomicUsize::new(0);
    static NUM_LIFO_SCHEDULES: AtomicUsize = AtomicUsize::new(0);
    static NUM_LIFO_CAPPED: AtomicUsize = AtomicUsize::new(0);

    impl Drop for super::Counters {
        fn drop(&mut self) {
            let notifies_local = NUM_NOTIFY_LOCAL.load(Relaxed);
            let unparks_local = NUM_UNPARKS_LOCAL.load(Relaxed);
            let maintenance = NUM_MAINTENANCE.load(Relaxed);
            let lifo_scheds = NUM_LIFO_SCHEDULES.load(Relaxed);
            let lifo_capped = NUM_LIFO_CAPPED.load(Relaxed);

            println!("---");
            println!("notifies (local): {}", notifies_local);
            println!(" unparks (local): {}", unparks_local);
            println!("     maintenance: {}", maintenance);
            println!("  LIFO schedules: {}", lifo_scheds);
            println!("     LIFO capped: {}", lifo_capped);
        }
    }

    pub(crate) fn inc_num_inc_notify_local() {
        NUM_NOTIFY_LOCAL.fetch_add(1, Relaxed);
    }

    pub(crate) fn inc_num_unparks_local() {
        NUM_UNPARKS_LOCAL.fetch_add(1, Relaxed);
    }

    pub(crate) fn inc_num_maintenance() {
        NUM_MAINTENANCE.fetch_add(1, Relaxed);
    }

    pub(crate) fn inc_lifo_schedules() {
        NUM_LIFO_SCHEDULES.fetch_add(1, Relaxed);
    }

    pub(crate) fn inc_lifo_capped() {
        NUM_LIFO_CAPPED.fetch_add(1, Relaxed);
    }
}

#[cfg(not(tokio_internal_mt_counters))]
mod imp {
    pub(crate) fn inc_num_inc_notify_local() {}
    pub(crate) fn inc_num_unparks_local() {}
    pub(crate) fn inc_num_maintenance() {}
    pub(crate) fn inc_lifo_schedules() {}
    pub(crate) fn inc_lifo_capped() {}
}

#[derive(Debug)]
pub(crate) struct Counters;

pub(super) use imp::*;

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/tokio-1.43.0/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-28.0.0 ./ext/cargo-vendor/tokio-1.43.0/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-27.0.0 ./ext/cargo-vendor/tokio-1.41.1/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-26.0.0 ./ext/cargo-vendor/tokio-1.41.0/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-25.0.2 ./ext/cargo-vendor/tokio-1.40.0/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-25.0.1 ./ext/cargo-vendor/tokio-1.39.3/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-25.0.0 ./ext/cargo-vendor/tokio-1.39.3/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-24.0.0 ./ext/cargo-vendor/tokio-1.39.3/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-23.0.2 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-22.0.0 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-21.0.1 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-20.0.2 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-20.0.0 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-18.0.3 ./ext/cargo-vendor/tokio-1.36.0/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-17.0.1 ./ext/cargo-vendor/tokio-1.35.1/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-17.0.0 ./ext/cargo-vendor/tokio-1.35.1/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-16.0.0 ./ext/cargo-vendor/tokio-1.35.1/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-15.0.1 ./ext/cargo-vendor/tokio-1.35.1/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-15.0.0 ./ext/cargo-vendor/tokio-1.35.1/src/runtime/scheduler/multi_thread/counters.rs
wasmtime-14.0.4 ./ext/cargo-vendor/tokio-1.33.0/src/runtime/scheduler/multi_thread/counters.rs