Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the description of steal_count #35

Merged
merged 2 commits into from
Feb 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ tokio::spawn(do_work());
- **[`min_noop_count`]**
The minimum number of times any worker thread unparked but performed no work before parking again.
- **[`total_steal_count`]**
The number of times worker threads stole tasks from another worker thread.
The number of tasks worker threads stole from another worker thread.
- **[`max_steal_count`]**
The maximum number of times any worker thread stole tasks from another worker thread.
The maximum number of tasks any worker thread stole from another worker thread.
- **[`min_steal_count`]**
The minimum number of times any worker thread stole tasks from another worker thread.
The minimum number of tasks any worker thread stole from another worker thread.
- **[`num_remote_schedules`]**
The number of tasks scheduled from outside of the runtime.
- **[`total_local_schedule_count`]**
Expand Down
13 changes: 7 additions & 6 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,10 +254,11 @@ pub struct RuntimeMetrics {
/// - [`RuntimeMetrics::max_noop_count`]
pub min_noop_count: u64,

/// The number of times worker threads stole tasks from another worker thread.
/// The number of tasks worker threads stole from another worker thread.
///
/// The worker steal count starts increases by one each time the worker has processed its
/// scheduled queue and successfully steals more pending tasks from another worker.
/// The worker steal count starts increases by the amount of stolen tasks each time the worker
/// has processed its scheduled queue and successfully steals more pending tasks from another
/// worker.
///
/// This metric only applies to the **multi-threaded** runtime and will always return `0` when
/// using the current thread runtime.
Expand Down Expand Up @@ -297,7 +298,7 @@ pub struct RuntimeMetrics {
/// // Spawn a task that bumps the previous task out of the "next
/// // scheduled" slot.
/// tokio::spawn(async {});
/// // Blocking receive on the channe.
/// // Blocking receive on the channel.
/// rx.recv().unwrap();
/// flush_metrics().await;
/// }).await.unwrap();
Expand All @@ -321,7 +322,7 @@ pub struct RuntimeMetrics {
/// ```
pub total_steal_count: u64,

/// The maximum number of times any worker thread stole tasks from another worker thread.
/// The maximum number of tasks any worker thread stole from another worker thread.
///
/// ##### Definition
/// This metric is derived from the maximum of [`tokio::runtime::RuntimeMetrics::worker_steal_count`]
Expand All @@ -332,7 +333,7 @@ pub struct RuntimeMetrics {
/// - [`RuntimeMetrics::min_steal_count`]
pub max_steal_count: u64,

/// The minimum number of times any worker thread stole tasks from another worker thread.
/// The minimum number of tasks any worker thread stole from another worker thread.
///
/// ##### Definition
/// This metric is derived from the minimum of [`tokio::runtime::RuntimeMetrics::worker_steal_count`]
Expand Down
2 changes: 1 addition & 1 deletion src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2431,7 +2431,7 @@ impl ArcWake for State {
#[inline(always)]
fn to_nanos(d: Duration) -> u64 {
debug_assert!(d <= Duration::from_nanos(u64::MAX));
(d.as_secs() as u64)
d.as_secs()
.wrapping_mul(1_000_000_000)
.wrapping_add(d.subsec_nanos() as u64)
}
Expand Down