id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:22 | if let Some(task) = self.steal_one_round(cx, &mut core, start) {
return Ok((Some(task), core));
}
core = try_task!(self.next_remote_task_batch(cx, core));
if i > 0 {
super::counters::inc_num_spin_stall();
std::thread::sleep(std::time:... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 841 | 900 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:23 | return Some(task);
}
}
None
}
fn run_task(&mut self, cx: &Context, mut core: Box<Core>, task: Notified) -> RunResult {
let task = cx.shared().owned.assert_owner(task);
// Make sure the worker is not in the **searching** state. This enables
// another idle w... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 881 | 940 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:24 | Some(core) => core,
None => {
// In this case, we cannot call `reset_lifo_enabled()`
// because the core was stolen. The stealer will handle
// that at the top of `Context::run`
return Err(());
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 921 | 980 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:25 | // LIFO slot can cause starvation as these two tasks will
// repeatedly schedule the other. To mitigate this, we limit the
// number of times the LIFO slot is prioritized.
if lifo_polls >= MAX_LIFO_POLLS_PER_TICK {
cx.lifo_enabled.set(false);
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 961 | 1,020 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:26 | .push_remote_task_batch_synced(&mut synced, defer.drain(..num_fanout));
cx.shared()
.idle
.notify_mult(&mut synced, &mut self.workers_to_notify, num_fanout);
}
// Do not run the task while holding the lock...
drop(synced);
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,001 | 1,060 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:27 | // Notify workers
cx.shared()
.idle
.notify_mult(synced, &mut self.workers_to_notify, num);
// Notify any workers
for worker in self.workers_to_notify.drain(..) {
cx.shared().condvars[worker].notify_one()
}
}
}
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,041 | 1,100 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:28 | fn park_yield(&mut self, cx: &Context, core: Box<Core>) -> NextTaskResult {
// Call `park` with a 0 timeout. This enables the I/O driver, timer, ...
// to run without actually putting the thread to sleep.
if let Some(mut driver) = cx.shared().driver.take() {
driver.park_timeout(&cx.h... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,081 | 1,140 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:29 | }
if self.can_transition_to_parked(&mut core) {
debug_assert!(!self.is_shutdown);
debug_assert!(!self.is_traced);
core = try_task!(self.do_park(cx, core));
}
if let Some(f) = &cx.shared().config.after_unpark {
f();
}
Ok((None, c... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,121 | 1,180 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:30 | if cx
.shared()
.idle
.transition_worker_to_searching_if_needed(&mut synced.idle, &mut core)
{
// Skip parking, go back to searching
return Ok((None, core));
}
}
super::counters::inc_num_parks();
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,161 | 1,220 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:31 | if cx.shared().inject.is_closed(&mut synced.inject) {
self.shutdown_clear_defer(cx);
self.shutdown_finalize(cx, synced);
return Err(());
}
// Try to acquire an available core to schedule I/O events
if let Some(core) = self.try_acquire_... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,201 | 1,260 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:32 | fn can_transition_to_parked(&self, core: &mut Core) -> bool {
!self.has_tasks(core) && !self.is_shutdown && !self.is_traced
}
fn has_tasks(&self, core: &Core) -> bool {
core.lifo_slot.is_some() || !core.run_queue.is_empty()
}
/// Signals all tasks to shut down, and waits for them to co... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,241 | 1,300 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:33 | for mut core in synced.shutdown_cores.drain(..) {
// Drain tasks from the local queue
while self.next_local_task(&mut core).is_some() {}
}
// Shutdown the driver
driver.shutdown(&cx.handle.driver);
// Drain the injection queue
//
// We already sh... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,281 | 1,340 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:34 | }
}
fn shutdown_clear_defer(&self, cx: &Context) {
let mut defer = cx.defer.borrow_mut();
for task in defer.drain(..) {
drop(task);
}
}
}
impl Context {
pub(crate) fn defer(&self, waker: &Waker) {
// TODO: refactor defer across all runtimes
waker.wa... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,321 | 1,380 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:35 | // (`block_in_place`) or the notification happens from
// the driver.
cx.defer.borrow_mut().push(task);
}
return;
}
}
// Otherwise, use the inject queue.
self.schedule_remote(task... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,361 | 1,420 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:36 | fn schedule_remote(&self, task: Notified) {
super::counters::inc_num_notify_remote();
self.scheduler_metrics.inc_remote_schedule_count();
let mut synced = self.synced.lock();
// Push the task in the
self.push_remote_task(&mut synced, task);
// Notify a worker. The mutex... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,401 | 1,460 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:37 | I: Iterator<Item = task::Notified<Arc<Handle>>>,
{
unsafe {
self.inject.push_batch(&mut synced.inject, iter);
}
}
}
impl Overflow<Arc<Handle>> for Shared {
fn push(&self, task: task::Notified<Arc<Handle>>) {
self.push_remote_task(&mut self.synced.lock(), task);
}
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,441 | 1,500 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker.rs:38 | fn yield_now(&self, task: Notified) {
self.shared.schedule_task(task, true);
}
}
pub(crate) struct InjectGuard<'a> {
lock: crate::loom::sync::MutexGuard<'a, Synced>,
}
impl<'a> AsMut<inject::Synced> for InjectGuard<'a> {
fn as_mut(&mut self) -> &mut inject::Synced {
&mut self.lock.inject
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs | 1,481 | 1,513 |
tokio-rs/tokio:tokio/src/runtime/scheduler/multi_thread_alt/worker/metrics.rs:1 | use super::Shared;
impl Shared {
pub(crate) fn injection_queue_depth(&self) -> usize {
self.inject.len()
}
pub(crate) fn worker_local_queue_depth(&self, worker: usize) -> usize {
self.remotes[worker].steal.len()
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/multi_thread_alt/worker/metrics.rs | MIT | 4165601b1bbaa7c29cbfb319fe75a9adddf4085e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/scheduler/multi_thread_alt/worker/metrics.rs | 1 | 11 |
tokio-rs/tokio:tokio/src/runtime/scheduler/util/time_alt.rs:1 | use crate::runtime::scheduler::driver;
use crate::runtime::time_alt::cancellation_queue::{Receiver, Sender};
use crate::runtime::time_alt::{EntryHandle, RegistrationQueue, WakeQueue, Wheel};
use std::time::Duration;
pub(crate) fn min_duration(a: Option<Duration>, b: Option<Duration>) -> Option<Duration> {
match (a... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/util/time_alt.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/util/time_alt.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/scheduler/util/time_alt.rs:2 | for hdl in inject {
if hdl.deadline() <= wheel.elapsed() {
unsafe {
wake_queue.push_front(hdl);
}
} else {
// Safety: the entry is not registered yet
unsafe {
wheel.insert(hdl, tx.clone());
}
}
}
}
p... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/util/time_alt.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/util/time_alt.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/scheduler/util/time_alt.rs:3 | })
})
}
#[cfg(feature = "test-util")]
pub(crate) fn pre_auto_advance(drv_hdl: &driver::Handle, duration: Option<Duration>) -> bool {
drv_hdl.with_time(|maybe_time_hdl| {
if maybe_time_hdl.is_none() {
// time driver is not enabled, nothing to do.
return false;
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/util/time_alt.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/util/time_alt.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/scheduler/util/time_alt.rs:4 | time_hdl.process_at_time_alt(wheel, now, wake_queue);
});
}
pub(crate) fn shutdown_local_timers(
wheel: &mut Wheel,
rx: &mut Receiver,
inject: Vec<EntryHandle>,
drv_hdl: &driver::Handle,
) {
drv_hdl.with_time(|maybe_time_hdl| {
let Some(time_hdl) = maybe_time_hdl else {
// t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/util/time_alt.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/util/time_alt.rs | 121 | 179 |
tokio-rs/tokio:tokio/src/runtime/scheduler/util/time_alt.rs:5 | let clock = drv_hdl.clock();
if clock.can_auto_advance() && !time_hdl.did_wake() {
if let Err(msg) = clock.advance(park_duration) {
panic!("{msg}");
}
}
}
})
}
#[cfg(not(feature = "test-util"))]
pub(crate) fn pre_auto_advance(_drv_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/util/time_alt.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/scheduler/util/time_alt.rs | 161 | 179 |
tokio-rs/tokio:tokio/src/runtime/scheduler/util/time_alt.rs:4 | time_hdl.process_at_time_alt(wheel, now, wake_queue);
});
}
pub(crate) fn shutdown_local_timers(
wheel: &mut Wheel,
rx: &mut Receiver,
inject: Vec<EntryHandle>,
drv_hdl: &driver::Handle,
) {
drv_hdl.with_time(|maybe_time_hdl| {
let Some(time_hdl) = maybe_time_hdl else {
// t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/util/time_alt.rs | MIT | 73d733a3415af98d72c2cce40612c4e59adbd5d8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/scheduler/util/time_alt.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/scheduler/util/time_alt.rs:5 | if let Some(park_duration) = duration {
let clock = drv_hdl.clock();
if clock.can_auto_advance() && !time_hdl.did_wake() {
if let Err(msg) = clock.advance(park_duration) {
panic!("{msg}");
}
}
}
})
}
#[cfg(not(feature =... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/scheduler/util/time_alt.rs | MIT | 73d733a3415af98d72c2cce40612c4e59adbd5d8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/73d733a3415af98d72c2cce40612c4e59adbd5d8/tokio/src/runtime/scheduler/util/time_alt.rs | 161 | 181 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:1 | #![allow(clippy::redundant_clone)]
use crate::future::poll_fn;
use crate::park::{Park, Unpark};
use crate::runtime::driver::Driver;
use crate::sync::Notify;
use crate::util::{waker_ref, Wake};
use std::sync::{Arc, Mutex};
use std::task::Context;
use std::task::Poll::{Pending, Ready};
use std::{future::Future, sync::P... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/shell.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:2 | {
let mut enter = crate::runtime::enter(true);
pin!(f);
loop {
if let Some(driver) = &mut self.take_driver() {
return driver.block_on(f);
} else {
let notified = self.notify.notified();
pin!(notified);
if ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/shell.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:3 | }
}
impl Wake for Handle {
/// Wake by value
fn wake(self: Arc<Self>) {
Wake::wake_by_ref(&self);
}
/// Wake by reference
fn wake_by_ref(arc_self: &Arc<Self>) {
arc_self.0.unpark();
}
}
struct DriverGuard<'a> {
inner: Option<Driver>,
shell: &'a Shell,
}
impl DriverGua... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/shell.rs | 81 | 132 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:4 | fn drop(&mut self) {
if let Some(inner) = self.inner.take() {
self.shell
.driver
.lock()
.unwrap_or_else(PoisonError::into_inner)
.replace(inner);
self.shell.notify.notify_one();
}
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4dfbdbff7e260eb7f046a8dc91ec0c84ae7ab2e8/tokio/src/runtime/shell.rs | 121 | 132 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:1 | #![allow(clippy::redundant_clone)]
use crate::park::{Park, Unpark};
use crate::runtime::driver::Driver;
use crate::runtime::enter;
use crate::util::{waker_ref, Wake};
use std::future::Future;
use std::sync::Arc;
use std::task::Context;
use std::task::Poll::Ready;
#[derive(Debug)]
pub(super) struct Shell {
driver... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/runtime/shell.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:2 | loop {
if let Ready(v) = crate::coop::budget(|| f.as_mut().poll(&mut cx)) {
return v;
}
self.driver.park().unwrap();
}
}
}
impl Wake for Handle {
/// Wake by value
fn wake(self: Arc<Self>) {
Wake::wake_by_ref(&self);
}
/// Wake b... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7ae5b7bd4f93612f91ab504ffb63aa8241c1d7bb/tokio/src/runtime/shell.rs | 41 | 62 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:1 | #![allow(clippy::redundant_clone)]
use crate::park::{Park, Unpark};
use crate::runtime::enter;
use crate::runtime::time;
use crate::util::{waker_ref, Wake};
use std::future::Future;
use std::sync::Arc;
use std::task::Context;
use std::task::Poll::Ready;
#[derive(Debug)]
pub(super) struct Shell {
driver: time::Dr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 282b00cbe888a96669877ce70662fba87e8c0e3c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/282b00cbe888a96669877ce70662fba87e8c0e3c/tokio/src/runtime/shell.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:1 | #![allow(clippy::redundant_clone)]
use crate::park::{Park, Unpark};
use crate::runtime::enter;
use crate::runtime::time;
use crate::util::{waker_ref, Wake};
use std::future::Future;
use std::sync::Arc;
use std::task::Context;
use std::task::Poll::Ready;
#[derive(Debug)]
pub(super) struct Shell {
driver: time::Dr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | dd27f1a259033cc6328ccad1f73f753e52976a65 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dd27f1a259033cc6328ccad1f73f753e52976a65/tokio/src/runtime/shell.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:1 | #![allow(clippy::redundant_clone)]
use crate::park::Park;
use crate::runtime::enter;
use crate::runtime::time;
use std::future::Future;
use std::mem::ManuallyDrop;
use std::pin::Pin;
use std::sync::Arc;
use std::task::Poll::Ready;
use std::task::{Context, RawWaker, RawWakerVTable, Waker};
#[derive(Debug)]
pub(super)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 06a4d895ec8787386058a24b422dfa9a8514bc8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/runtime/shell.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:2 | F: Future,
{
let _e = enter();
let mut f = unsafe { Pin::new_unchecked(&mut f) };
let mut cx = Context::from_waker(&self.waker);
loop {
if let Ready(v) = crate::coop::budget(|| f.as_mut().poll(&mut cx)) {
return v;
}
self.driver.... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 06a4d895ec8787386058a24b422dfa9a8514bc8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/runtime/shell.rs | 41 | 83 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:1 | #![allow(clippy::redundant_clone)]
use crate::park::Park;
use crate::runtime::enter;
use crate::runtime::time;
use std::future::Future;
use std::mem::ManuallyDrop;
use std::pin::Pin;
use std::sync::Arc;
use std::task::Poll::Ready;
use std::task::{Context, RawWaker, RawWakerVTable, Waker};
#[derive(Debug)]
pub(super)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | d593c5b051f07bde5117122216a356632986b6dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/src/runtime/shell.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:2 | F: Future,
{
let _e = enter();
let mut f = unsafe { Pin::new_unchecked(&mut f) };
let mut cx = Context::from_waker(&self.waker);
loop {
if let Ready(v) = f.as_mut().poll(&mut cx) {
return v;
}
self.driver.park().unwrap();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | d593c5b051f07bde5117122216a356632986b6dd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/src/runtime/shell.rs | 41 | 83 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:1 | use crate::park::Park;
use crate::runtime::enter;
use crate::runtime::time;
use std::future::Future;
use std::mem::ManuallyDrop;
use std::pin::Pin;
use std::sync::Arc;
use std::task::Poll::Ready;
use std::task::{Context, RawWaker, RawWakerVTable, Waker};
#[derive(Debug)]
pub(super) struct Shell {
driver: time::Dr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/shell.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:2 | let _e = enter();
let mut f = unsafe { Pin::new_unchecked(&mut f) };
let mut cx = Context::from_waker(&self.waker);
loop {
if let Ready(v) = f.as_mut().poll(&mut cx) {
return v;
}
self.driver.park().unwrap();
}
}
}
fn clone_wake... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/shell.rs | 41 | 81 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:1 | use crate::runtime::time;
use crate::runtime::{enter, io, Park};
use std::future::Future;
use std::mem::ManuallyDrop;
use std::pin::Pin;
use std::sync::Arc;
use std::task::Poll::Ready;
use std::task::{Context, RawWaker, RawWakerVTable, Waker};
#[derive(Debug)]
pub(super) struct Shell {
driver: time::Driver,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 27e5b41067d01c0c9fac230c5addb58034201a63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/shell.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/shell.rs:2 | let mut f = unsafe { Pin::new_unchecked(&mut f) };
let mut cx = Context::from_waker(&self.waker);
loop {
if let Ready(v) = f.as_mut().poll(&mut cx) {
return v;
}
self.driver.park().unwrap();
}
}
}
fn clone_waker(ptr: *const ()) -> RawWak... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/shell.rs | MIT | 27e5b41067d01c0c9fac230c5addb58034201a63 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/27e5b41067d01c0c9fac230c5addb58034201a63/tokio/src/runtime/shell.rs | 41 | 79 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:1 | #![cfg_attr(not(feature = "rt"), allow(dead_code))]
//! Signal driver
use crate::runtime::{driver, io};
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self as std_io, Read};
use std::sync::{Arc, Weak};
use std::time::Duration;
/// Responsible for registering wakeups when an OS signal ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/signal/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:2 | impl Driver {
/// Creates a new signal `Driver` instance that delegates wakeups to `park`.
pub(crate) fn new(io: io::Driver, io_handle: &io::Handle) -> std_io::Result<Self> {
use std::mem::ManuallyDrop;
use std::os::unix::io::{AsRawFd, FromRawFd};
// NB: We give each driver a "fresh" re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/signal/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:3 | }
/// Returns a handle to this event loop which can be sent across threads
/// and can be used as a proxy to the event loop itself.
pub(crate) fn handle(&self) -> Handle {
Handle {
inner: Arc::downgrade(&self.inner),
}
}
pub(crate) fn park(&mut self, handle: &driver::Ha... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/signal/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:4 | Err(e) => panic!("Bad read on self-pipe: {e}"),
}
}
// Broadcast any signals which were received
globals().broadcast();
}
}
// ===== impl Handle =====
impl Handle {
pub(crate) fn check_inner(&self) -> std_io::Result<()> {
if self.inner.strong_count() > 0 {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/signal/mod.rs | 121 | 143 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:3 | }
/// Returns a handle to this event loop which can be sent across threads
/// and can be used as a proxy to the event loop itself.
pub(crate) fn handle(&self) -> Handle {
Handle {
inner: Arc::downgrade(&self.inner),
}
}
pub(crate) fn park(&mut self, handle: &driver::Ha... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 3936ebdfe4f44eda5630a9b461bbbc9976e5542c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3936ebdfe4f44eda5630a9b461bbbc9976e5542c/tokio/src/runtime/signal/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:4 | Err(e) => panic!("Bad read on self-pipe: {}", e),
}
}
// Broadcast any signals which were received
globals().broadcast();
}
}
// ===== impl Handle =====
impl Handle {
pub(crate) fn check_inner(&self) -> std_io::Result<()> {
if self.inner.strong_count() > 0 {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 3936ebdfe4f44eda5630a9b461bbbc9976e5542c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3936ebdfe4f44eda5630a9b461bbbc9976e5542c/tokio/src/runtime/signal/mod.rs | 121 | 143 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:3 | }
/// Returns a handle to this event loop which can be sent across threads
/// and can be used as a proxy to the event loop itself.
pub(crate) fn handle(&self) -> Handle {
Handle {
inner: Arc::downgrade(&self.inner),
}
}
pub(crate) fn park(&mut self, handle: &driver::Ha... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/signal/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:4 | }
}
// Broadcast any signals which were received
globals().broadcast();
}
}
// ===== impl Handle =====
impl Handle {
pub(crate) fn check_inner(&self) -> std_io::Result<()> {
if self.inner.strong_count() > 0 {
Ok(())
} else {
Err(std_io::Error::n... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/signal/mod.rs | 121 | 142 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:3 | }
/// Returns a handle to this event loop which can be sent across threads
/// and can be used as a proxy to the event loop itself.
pub(crate) fn handle(&self) -> Handle {
Handle {
inner: Arc::downgrade(&self.inner),
}
}
pub(crate) fn park(&mut self, handle: &driver::Ha... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 6da81471f959e59de0af0d0a3829112eeaf76e01 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6da81471f959e59de0af0d0a3829112eeaf76e01/tokio/src/runtime/signal/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:3 | }
/// Returns a handle to this event loop which can be sent across threads
/// and can be used as a proxy to the event loop itself.
pub(crate) fn handle(&self) -> Handle {
Handle {
inner: Arc::downgrade(&self.inner),
}
}
pub(crate) fn park(&mut self, handle: &driver::Ha... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 6c19748f901a1b8cd7fbf84650f1647342b5a66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6c19748f901a1b8cd7fbf84650f1647342b5a66e/tokio/src/runtime/signal/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:1 | #![cfg_attr(not(feature = "rt"), allow(dead_code))]
//! Signal driver
use crate::runtime::{driver, io};
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self as std_io, Read};
use std::sync::{Arc, Weak};
use std::time::Duration;
/// Responsible for registering wakeups when an OS signal ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 58c457190b8a79b7ed8a76910e4d84d9d5de163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/signal/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:2 | /// Creates a new signal `Driver` instance that delegates wakeups to `park`.
pub(crate) fn new(io: io::Driver, io_handle: &io::Handle) -> std_io::Result<Self> {
use std::mem::ManuallyDrop;
use std::os::unix::io::{AsRawFd, FromRawFd};
// NB: We give each driver a "fresh" receiver file descri... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 58c457190b8a79b7ed8a76910e4d84d9d5de163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/signal/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:3 | /// Returns a handle to this event loop which can be sent across threads
/// and can be used as a proxy to the event loop itself.
pub(crate) fn handle(&self) -> Handle {
Handle {
inner: Arc::downgrade(&self.inner),
}
}
pub(crate) fn park(&mut self, handle: &driver::Handle) {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 58c457190b8a79b7ed8a76910e4d84d9d5de163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/signal/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:4 | }
// Broadcast any signals which were received
globals().broadcast();
}
}
// ===== impl Handle =====
impl Handle {
pub(crate) fn check_inner(&self) -> std_io::Result<()> {
if self.inner.strong_count() > 0 {
Ok(())
} else {
Err(std_io::Error::new(
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 58c457190b8a79b7ed8a76910e4d84d9d5de163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/signal/mod.rs | 121 | 174 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:5 | /// Returns a handle to the current driver
///
/// # Panics
///
/// This function panics if there is no current signal driver set.
#[track_caller]
pub(crate) fn current() -> Self {
panic!(
"there is no signal driver running, must be called from... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | 58c457190b8a79b7ed8a76910e4d84d9d5de163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/signal/mod.rs | 161 | 174 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:1 | #![cfg_attr(not(feature = "rt"), allow(dead_code))]
//! Signal driver
use crate::runtime::io;
use crate::signal::registry::globals;
use mio::net::UnixStream;
use std::io::{self as std_io, Read};
use std::sync::{Arc, Weak};
use std::time::Duration;
/// Responsible for registering wakeups when an OS signal is receive... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | ec66a92b016914f2ead483bada32ffe696a2fd3a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/signal/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:2 | /// Creates a new signal `Driver` instance that delegates wakeups to `park`.
pub(crate) fn new(mut io: io::Driver) -> std_io::Result<Self> {
use std::mem::ManuallyDrop;
use std::os::unix::io::{AsRawFd, FromRawFd};
// NB: We give each driver a "fresh" receiver file descriptor to avoid
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | ec66a92b016914f2ead483bada32ffe696a2fd3a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/signal/mod.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/signal/mod.rs:3 | /// Returns a handle to this event loop which can be sent across threads
/// and can be used as a proxy to the event loop itself.
pub(crate) fn handle(&self) -> Handle {
Handle {
inner: Arc::downgrade(&self.inner),
}
}
pub(crate) fn park(&mut self) {
self.io.park();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/signal/mod.rs | MIT | ec66a92b016914f2ead483bada32ffe696a2fd3a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/signal/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | use crate::future::Future;
use crate::runtime::scheduler::current_thread;
use crate::runtime::task::Id;
use crate::task::JoinHandle;
cfg_rt_multi_thread! {
use crate::runtime::scheduler::multi_thread;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
CurrentThread(current_thread::Spawner),
#[cfg(all(fea... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 56ffea09e5ab682e49eab0374da651f277e72566 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/56ffea09e5ab682e49eab0374da651f277e72566/tokio/src/runtime/spawner.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:2 | use crate::runtime::{SchedulerMetrics, WorkerMetrics};
impl Spawner {
pub(crate) fn num_workers(&self) -> usize {
match self {
Spawner::CurrentThread(_) => 1,
#[cfg(all(feature = "rt-multi-thread", not(tokio_wasi)))]
Spawner::MultiThread(spawner) ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 56ffea09e5ab682e49eab0374da651f277e72566 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/56ffea09e5ab682e49eab0374da651f277e72566/tokio/src/runtime/spawner.rs | 41 | 84 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | use crate::future::Future;
use crate::runtime::scheduler::current_thread;
use crate::runtime::task::Id;
use crate::runtime::HandleInner;
use crate::task::JoinHandle;
cfg_rt_multi_thread! {
use crate::runtime::scheduler::multi_thread;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
CurrentThread(current_th... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | a3411a412c3424df7dcd151441fe0435c0a92c9c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a3411a412c3424df7dcd151441fe0435c0a92c9c/tokio/src/runtime/spawner.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:2 | match self {
Spawner::CurrentThread(spawner) => spawner.as_handle_inner(),
#[cfg(all(feature = "rt-multi-thread", not(tokio_wasi)))]
Spawner::MultiThread(spawner) => spawner.as_handle_inner(),
}
}
}
cfg_metrics! {
use crate::runtime::{SchedulerMetrics, WorkerMetrics}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | a3411a412c3424df7dcd151441fe0435c0a92c9c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a3411a412c3424df7dcd151441fe0435c0a92c9c/tokio/src/runtime/spawner.rs | 41 | 93 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:3 | Spawner::MultiThread(spawner) => spawner.injection_queue_depth(),
}
}
pub(crate) fn worker_local_queue_depth(&self, worker: usize) -> usize {
match self {
Spawner::CurrentThread(spawner) => spawner.worker_metrics(worker).queue_depth(),
#[cfg(all(f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | a3411a412c3424df7dcd151441fe0435c0a92c9c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a3411a412c3424df7dcd151441fe0435c0a92c9c/tokio/src/runtime/spawner.rs | 81 | 93 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | use crate::future::Future;
use crate::runtime::task::Id;
use crate::runtime::{basic_scheduler, HandleInner};
use crate::task::JoinHandle;
cfg_rt_multi_thread! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
Basic(basic_scheduler::Spawner),
#[cfg(all(feature = "rt-mul... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/src/runtime/spawner.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:2 | Spawner::Basic(spawner) => spawner.as_handle_inner(),
#[cfg(all(feature = "rt-multi-thread", not(tokio_wasi)))]
Spawner::ThreadPool(spawner) => spawner.as_handle_inner(),
}
}
}
cfg_metrics! {
use crate::runtime::{SchedulerMetrics, WorkerMetrics};
impl Spawner {
pub(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/src/runtime/spawner.rs | 41 | 92 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:3 | }
}
pub(crate) fn worker_local_queue_depth(&self, worker: usize) -> usize {
match self {
Spawner::Basic(spawner) => spawner.worker_metrics(worker).queue_depth(),
#[cfg(all(feature = "rt-multi-thread", not(tokio_wasi)))]
Spawner::ThreadPool(spa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/src/runtime/spawner.rs | 81 | 92 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | use crate::future::Future;
use crate::runtime::task::Id;
use crate::runtime::{basic_scheduler, HandleInner};
use crate::task::JoinHandle;
cfg_rt_multi_thread! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
Basic(basic_scheduler::Spawner),
#[cfg(all(feature = "rt-mul... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/src/runtime/spawner.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:2 | Spawner::Basic(spawner) => spawner.as_handle_inner(),
#[cfg(all(feature = "rt-multi-thread", not(target_os = "wasi")))]
Spawner::ThreadPool(spawner) => spawner.as_handle_inner(),
}
}
}
cfg_metrics! {
use crate::runtime::{SchedulerMetrics, WorkerMetrics};
impl Spawner {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/src/runtime/spawner.rs | 41 | 92 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:3 | }
}
pub(crate) fn worker_local_queue_depth(&self, worker: usize) -> usize {
match self {
Spawner::Basic(spawner) => spawner.worker_metrics(worker).queue_depth(),
#[cfg(all(feature = "rt-multi-thread", not(target_os = "wasi")))]
Spawner::Thread... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/src/runtime/spawner.rs | 81 | 92 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | use crate::future::Future;
use crate::runtime::task::Id;
use crate::runtime::{basic_scheduler, HandleInner};
use crate::task::JoinHandle;
cfg_rt_multi_thread! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
Basic(basic_scheduler::Spawner),
#[cfg(feature = "rt-multi-t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/spawner.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:2 | Spawner::Basic(spawner) => spawner.as_handle_inner(),
#[cfg(feature = "rt-multi-thread")]
Spawner::ThreadPool(spawner) => spawner.as_handle_inner(),
}
}
}
cfg_metrics! {
use crate::runtime::{SchedulerMetrics, WorkerMetrics};
impl Spawner {
pub(crate) fn num_workers(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/spawner.rs | 41 | 92 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:3 | }
}
pub(crate) fn worker_local_queue_depth(&self, worker: usize) -> usize {
match self {
Spawner::Basic(spawner) => spawner.worker_metrics(worker).queue_depth(),
#[cfg(feature = "rt-multi-thread")]
Spawner::ThreadPool(spawner) => spawner.worke... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/runtime/spawner.rs | 81 | 92 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | use crate::future::Future;
use crate::runtime::{basic_scheduler, HandleInner};
use crate::task::JoinHandle;
cfg_rt_multi_thread! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
Basic(basic_scheduler::Spawner),
#[cfg(feature = "rt-multi-thread")]
ThreadPool(thread... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 911a0efa87e36f0dffb13e3d52340d5c08415db1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/911a0efa87e36f0dffb13e3d52340d5c08415db1/tokio/src/runtime/spawner.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:2 | #[cfg(feature = "rt-multi-thread")]
Spawner::ThreadPool(spawner) => spawner.as_handle_inner(),
}
}
}
cfg_metrics! {
use crate::runtime::{SchedulerMetrics, WorkerMetrics};
impl Spawner {
pub(crate) fn num_workers(&self) -> usize {
match self {
Spawner... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 911a0efa87e36f0dffb13e3d52340d5c08415db1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/911a0efa87e36f0dffb13e3d52340d5c08415db1/tokio/src/runtime/spawner.rs | 41 | 91 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:3 | }
pub(crate) fn worker_local_queue_depth(&self, worker: usize) -> usize {
match self {
Spawner::Basic(spawner) => spawner.worker_metrics(worker).queue_depth(),
#[cfg(feature = "rt-multi-thread")]
Spawner::ThreadPool(spawner) => spawner.worker_local_qu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 911a0efa87e36f0dffb13e3d52340d5c08415db1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/911a0efa87e36f0dffb13e3d52340d5c08415db1/tokio/src/runtime/spawner.rs | 81 | 91 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | use crate::future::Future;
use crate::runtime::basic_scheduler;
use crate::task::JoinHandle;
cfg_rt_multi_thread! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
Basic(basic_scheduler::Spawner),
#[cfg(feature = "rt-multi-thread")]
ThreadPool(thread_pool::Spawner)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/spawner.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:2 | impl Spawner {
pub(crate) fn num_workers(&self) -> usize {
match self {
Spawner::Basic(_) => 1,
#[cfg(feature = "rt-multi-thread")]
Spawner::ThreadPool(spawner) => spawner.num_workers(),
}
}
pub(crate) fn scheduler_metrics(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/spawner.rs | 41 | 83 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | use crate::future::Future;
use crate::runtime::basic_scheduler;
use crate::runtime::stats::RuntimeStats;
use crate::task::JoinHandle;
cfg_rt_multi_thread! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
Basic(basic_scheduler::Spawner),
#[cfg(feature = "rt-multi-threa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 98578a6f4a494e709f00018b1cd5b0e3dd9a0f72 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/spawner.rs | 1 | 47 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | cfg_rt! {
use crate::future::Future;
use crate::runtime::basic_scheduler;
use crate::task::JoinHandle;
}
cfg_rt_multi_thread! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
#[cfg(feature = "rt")]
Basic(basic_scheduler::Spawner),
#[cfg(feature = "rt-m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | e7d74b3119178b9b86f7b547774b6b121de2239a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e7d74b3119178b9b86f7b547774b6b121de2239a/tokio/src/runtime/spawner.rs | 1 | 45 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | cfg_rt! {
use crate::runtime::basic_scheduler;
use crate::task::JoinHandle;
use std::future::Future;
}
cfg_rt_multi_thread! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
#[cfg(feature = "rt")]
Basic(basic_scheduler::Spawner),
#[cfg(feature = "rt-mu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | c90681bd8e629b5fde988b9f5be7b915e5cf8ae5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c90681bd8e629b5fde988b9f5be7b915e5cf8ae5/tokio/src/runtime/spawner.rs | 1 | 46 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | cfg_rt_core! {
use crate::runtime::basic_scheduler;
use crate::task::JoinHandle;
use std::future::Future;
}
cfg_rt_threaded! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
#[cfg(feature = "rt-core")]
Basic(basic_scheduler::Spawner),
#[cfg(feature = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/runtime/spawner.rs | 1 | 46 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | cfg_rt_core! {
use crate::runtime::basic_scheduler;
use crate::task::JoinHandle;
use std::future::Future;
}
cfg_rt_threaded! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
Shell,
#[cfg(feature = "rt-core")]
Basic(basic_scheduler::Spawner),
#[cfg... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 646fbae76535e397ef79dbcaacb945d4c829f666 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/runtime/spawner.rs | 1 | 48 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | cfg_rt_core! {
use crate::runtime::basic_scheduler;
use crate::task::JoinHandle;
use std::future::Future;
}
cfg_rt_threaded! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
Shell,
#[cfg(feature = "rt-core")]
Basic(basic_scheduler::Spawner),
#[cfg... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 67bf9c36f347031ca05872d102a7f9abc8b465f0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/67bf9c36f347031ca05872d102a7f9abc8b465f0/tokio/src/runtime/spawner.rs | 1 | 37 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | cfg_rt_core! {
use crate::runtime::basic_scheduler;
use crate::task::JoinHandle;
use std::future::Future;
}
cfg_rt_threaded! {
use crate::runtime::thread_pool;
}
#[derive(Debug, Clone)]
pub(crate) enum Spawner {
Shell,
#[cfg(feature = "rt-core")]
Basic(basic_scheduler::Spawner),
#[cfg... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/spawner.rs | 1 | 53 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:1 | use crate::runtime::current_thread;
#[cfg(feature = "rt-full")]
use crate::runtime::thread_pool;
use crate::runtime::JoinHandle;
use std::future::Future;
/// Spawns futures on the runtime
///
/// All futures spawned using this executor will be submitted to the associated
/// Runtime's executor. This executor is usual... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/runtime/spawner.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/spawner.rs:2 | kind: Kind::CurrentThread(spawner),
}
}
/// Spawn a future onto the Tokio runtime.
///
/// This spawns the given future onto the runtime's executor, usually a
/// thread pool. The thread pool is then responsible for polling the future
/// until it completes.
///
/// See [module ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/spawner.rs | MIT | d5c1119c881c9a8b511aa9000fd26b9bda014256 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d5c1119c881c9a8b511aa9000fd26b9bda014256/tokio/src/runtime/spawner.rs | 41 | 87 |
tokio-rs/tokio:tokio/src/runtime/stats/mock.rs:1 | //! This file contains mocks of the types in src/runtime/stats/stats.rs
pub(crate) struct RuntimeStats {}
impl RuntimeStats {
pub(crate) fn new(_worker_threads: usize) -> Self {
Self {}
}
}
pub(crate) struct WorkerStatsBatcher {}
impl WorkerStatsBatcher {
pub(crate) fn new(_my_index: usize) -> S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/mock.rs | MIT | 98578a6f4a494e709f00018b1cd5b0e3dd9a0f72 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/stats/mock.rs | 1 | 27 |
tokio-rs/tokio:tokio/src/runtime/stats/mod.rs:1 | //! This module contains information need to view information about how the
//! runtime is performing.
//!
//! **Note**: This is an [unstable API][unstable]. The public API of types in
//! this module may break in 1.x releases. See [the documentation on unstable
//! features][unstable] for details.
//!
//! [unstable]: ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/mod.rs | MIT | 78e0f0b42a4f7a50f3986f576703e5a3cb473b79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78e0f0b42a4f7a50f3986f576703e5a3cb473b79/tokio/src/runtime/stats/mod.rs | 1 | 23 |
tokio-rs/tokio:tokio/src/runtime/stats/mod.rs:1 | //! This module contains information need to view information about how the
//! runtime is performing.
#![allow(clippy::module_inception)]
cfg_stats! {
mod stats;
pub use self::stats::{RuntimeStats, WorkerStats};
pub(crate) use self::stats::WorkerStatsBatcher;
}
cfg_not_stats! {
#[path = "mock.rs"]
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/mod.rs | MIT | 98578a6f4a494e709f00018b1cd5b0e3dd9a0f72 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/98578a6f4a494e709f00018b1cd5b0e3dd9a0f72/tokio/src/runtime/stats/mod.rs | 1 | 17 |
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:1 | //! This file contains the types necessary to collect various types of stats.
use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed};
use std::convert::TryFrom;
use std::time::{Duration, Instant};
/// This type contains methods to retrieve stats from a Tokio runtime.
///
/// **Note**: This is an [unstable API]... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/stats.rs | MIT | 78e0f0b42a4f7a50f3986f576703e5a3cb473b79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78e0f0b42a4f7a50f3986f576703e5a3cb473b79/tokio/src/runtime/stats/stats.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:2 | steal_count: AtomicU64::new(0),
poll_count: AtomicU64::new(0),
busy_duration_total: AtomicU64::new(0),
});
}
Self {
workers: workers.into_boxed_slice(),
}
}
/// Returns a slice containing the worker stats for each worker thread.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/stats.rs | MIT | 78e0f0b42a4f7a50f3986f576703e5a3cb473b79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78e0f0b42a4f7a50f3986f576703e5a3cb473b79/tokio/src/runtime/stats/stats.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:3 | pub(crate) struct WorkerStatsBatcher {
my_index: usize,
park_count: u64,
steal_count: u64,
poll_count: u64,
/// The total busy duration in nanoseconds.
busy_duration_total: u64,
last_resume_time: Instant,
}
impl WorkerStatsBatcher {
pub(crate) fn new(my_index: usize) -> Self {
S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/stats.rs | MIT | 78e0f0b42a4f7a50f3986f576703e5a3cb473b79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78e0f0b42a4f7a50f3986f576703e5a3cb473b79/tokio/src/runtime/stats/stats.rs | 81 | 134 |
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:4 | pub(crate) fn returned_from_park(&mut self) {
self.last_resume_time = Instant::now();
}
#[cfg(feature = "rt-multi-thread")]
pub(crate) fn incr_steal_count(&mut self, by: u16) {
self.steal_count += u64::from(by);
}
pub(crate) fn incr_poll_count(&mut self) {
self.poll_count +... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/stats.rs | MIT | 78e0f0b42a4f7a50f3986f576703e5a3cb473b79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78e0f0b42a4f7a50f3986f576703e5a3cb473b79/tokio/src/runtime/stats/stats.rs | 121 | 134 |
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:1 | //! This file contains the types necessary to collect various types of stats.
use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed};
use std::convert::TryFrom;
use std::time::{Duration, Instant};
/// This type contains methods to retrieve stats from a Tokio runtime.
#[derive(Debug)]
pub struct RuntimeStats {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/stats.rs | MIT | ccf855ec24db7e91af7d60d4524dcd44d25d98c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ccf855ec24db7e91af7d60d4524dcd44d25d98c2/tokio/src/runtime/stats/stats.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:2 | pub fn workers(&self) -> impl Iterator<Item = &WorkerStats> {
self.workers.iter()
}
}
impl WorkerStats {
/// Returns the total number of times this worker thread has parked.
pub fn park_count(&self) -> u64 {
self.park_count.load(Relaxed)
}
/// Returns the number of tasks this worke... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/stats.rs | MIT | ccf855ec24db7e91af7d60d4524dcd44d25d98c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ccf855ec24db7e91af7d60d4524dcd44d25d98c2/tokio/src/runtime/stats/stats.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:3 | Self {
my_index,
park_count: 0,
steal_count: 0,
poll_count: 0,
busy_duration_total: 0,
last_resume_time: Instant::now(),
}
}
pub(crate) fn submit(&mut self, to: &RuntimeStats) {
let worker = &to.workers[self.my_index];
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/stats.rs | MIT | ccf855ec24db7e91af7d60d4524dcd44d25d98c2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ccf855ec24db7e91af7d60d4524dcd44d25d98c2/tokio/src/runtime/stats/stats.rs | 81 | 122 |
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:1 | //! This file contains the types necessary to collect various types of stats.
use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed};
use std::convert::TryFrom;
use std::time::{Duration, Instant};
/// This type contains methods to retrieve stats from a Tokio runtime.
#[derive(Debug)]
pub struct RuntimeStats {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/stats.rs | MIT | f45320a9c0b05c65b2d5e24ecb33edfd81ac45f9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f45320a9c0b05c65b2d5e24ecb33edfd81ac45f9/tokio/src/runtime/stats/stats.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:2 | Self {
workers: workers.into_boxed_slice(),
}
}
/// Returns a slice containing the worker stats for each worker thread.
pub fn workers(&self) -> impl Iterator<Item = &WorkerStats> {
self.workers.iter()
}
}
impl WorkerStats {
/// Returns the total number of times this wo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/stats.rs | MIT | f45320a9c0b05c65b2d5e24ecb33edfd81ac45f9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f45320a9c0b05c65b2d5e24ecb33edfd81ac45f9/tokio/src/runtime/stats/stats.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/stats/stats.rs:3 | Duration::from_nanos(self.busy_duration_min.load(Relaxed))
}
/// Returns the largest busy duration since the last 16 parks.
pub fn busy_duration_max(&self) -> Duration {
Duration::from_nanos(self.busy_duration_max.load(Relaxed))
}
}
pub(crate) struct WorkerStatsBatcher {
my_index: usize,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/stats/stats.rs | MIT | f45320a9c0b05c65b2d5e24ecb33edfd81ac45f9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f45320a9c0b05c65b2d5e24ecb33edfd81ac45f9/tokio/src/runtime/stats/stats.rs | 81 | 140 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.