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/metrics/histogram.rs:12 | assert_eq!(bucket.load(Relaxed), 0);
}
b.submit(&h);
for i in 0..h.buckets.len() {
assert_eq!(h.buckets[i].load(Relaxed), b.buckets[i]);
}
b.submit(&h);
for i in 0..h.buckets.len() {
assert_eq!(h.buckets[i].load(Relaxed), b.buckets[i]);
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/metrics/histogram.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/metrics/histogram.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram.rs:13 | b.measure(101, 19);
assert_bucket_eq!(b, 0, 8);
assert_bucket_eq!(b, 1, 21);
assert_bucket_eq!(b, 2, 0);
for bucket in h.buckets.iter() {
assert_eq!(bucket.load(Relaxed), 0);
}
b.submit(&h);
for i in 0..h.buckets.len() {
assert_eq!(h.buc... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/metrics/histogram.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/metrics/histogram.rs | 481 | 502 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:1 | use crate::runtime::metrics::batch::duration_as_u64;
use std::cmp;
use std::error::Error;
use std::fmt::{Display, Formatter};
use std::time::Duration;
const DEFAULT_MIN_VALUE: Duration = Duration::from_nanos(100);
const DEFAULT_MAX_VALUE: Duration = Duration::from_secs(60);
/// Default precision is 2^-2 = 25% max err... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:2 | fn default() -> Self {
LogHistogramBuilder::default().build()
}
}
impl LogHistogram {
/// Create a Histogram configuration directly from values for `n` and `p`.
///
/// # Panics
/// - If `bucket_offset` is greater than the specified number of buckets, `(n - p + 1) * 2^p`
fn from_n_p(n: ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:3 | let index = bucket_index(value, self.p);
let offset_bucket = index.saturating_sub(self.bucket_offset as u64);
let max = self.num_buckets - 1;
offset_bucket.min(max as u64) as usize
}
pub(crate) fn bucket_range(&self, bucket: usize) -> std::ops::Range<u64> {
let LogHistogram {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:4 | }
/// Configuration for a [`LogHistogram`]
///
/// The log-scaled histogram implements an H2 histogram where the first bucket covers
/// the range from 0 to [`LogHistogramBuilder::min_value`] and the final bucket covers
/// [`LogHistogramBuilder::max_value`] to infinity. The precision is bounded to the specified
/// [... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:5 | /// [`LogHistogramBuilder::precision_exact`].
///
/// Precision controls the size of the "bucket groups" (consecutive buckets with identical
/// ranges). When `p` is 0, each bucket will be twice the size of the previous bucket. To match
/// the behavior of the legacy log histogram implementation, use `b... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:6 | assert!(p <= MAX_PRECISION, "precision must be <= {MAX_PRECISION}");
self.precision = Some(p);
self
}
/// Sets the minimum duration that can be accurately stored by this histogram.
///
/// This sets the resolution. The first bucket will be no larger than
/// the provided duration. S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:7 | Ok(histogram)
}
/// Builds the log histogram
pub fn build(&self) -> LogHistogram {
let requested_max_value = duration_as_u64(self.max_value.unwrap_or(DEFAULT_MAX_VALUE));
let max_value = requested_max_value.next_power_of_two();
let min_value = duration_as_u64(self.min_value.unwrap_o... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:8 | /// Compute the index for a given value + p combination
///
/// This function does NOT enforce that the value is within the number of expected buckets.
fn bucket_index(value: u64, p: u32) -> u64 {
// Algorithm described here: https://iop.systems/blog/h2-histogram/
// find the highest non-zero digit
if value... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:9 | fn log_histogram_settings() -> impl Strategy<Value = (u64, u64, u32)> {
(
duration_as_u64(Duration::from_nanos(1))..duration_as_u64(Duration::from_secs(20)),
duration_as_u64(Duration::from_secs(1))..duration_as_u64(Duration::from_secs(1000)),
0..MAX_PRECISION,... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:10 | prop_assert_eq!(first_range.start, 0, "First bucket doesn't start at 0");
// Check that bucket ranges are disjoint and contiguous
let mut prev_end = 0;
let mut prev_size = 0;
for bucket in 0..histogram.num_buckets {
let range = histogr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:11 | }
prop_assert_eq!(prev_end, u64::MAX, "Last bucket should end at u64::MAX");
// Check bijection between value_to_bucket and bucket_range
for bucket in 0..histogram.num_buckets {
let range = histogram.bucket_range(bucket);
for value... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:12 | config.value_to_bucket(value as u64),
current_bucket + ((value - current_bucket) / 2),
"bucket for {value}"
);
value += 1;
}
}
// test buckets against known values
#[test]
fn bucket_computation_spot_check() {
let p = 9;
let... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:13 | for test in tests {
assert_eq!(config.value_to_bucket(test.v), test.bucket);
}
}
#[test]
fn last_bucket_goes_to_infinity() {
let conf = HistogramType::H2(LogHistogram::from_n_p(16, 3, 10));
assert_eq!(conf.bucket_range(conf.num_buckets() - 1).end, u64::MAX);
}
#... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 481 | 526 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:1 | use crate::runtime::metrics::batch::duration_as_u64;
use std::cmp;
use std::error::Error;
use std::fmt::{Display, Formatter};
use std::time::Duration;
const DEFAULT_MIN_VALUE: Duration = Duration::from_nanos(100);
const DEFAULT_MAX_VALUE: Duration = Duration::from_secs(60);
/// Default precision is 2^-2 = 25% max err... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:2 | fn default() -> Self {
LogHistogramBuilder::default().build()
}
}
impl LogHistogram {
/// Create a Histogram configuration directly from values for `n` and `p`.
///
/// # Panics
/// - If `bucket_offset` is greater than the specified number of buckets, `(n - p + 1) * 2^p`
fn from_n_p(n: ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:3 | let index = bucket_index(value, self.p);
let offset_bucket = if index < self.bucket_offset as u64 {
0
} else {
index - self.bucket_offset as u64
};
let max = self.num_buckets - 1;
offset_bucket.min(max as u64) as usize
}
pub(crate) fn bucket_range... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:4 | range_start_0th_bucket.unwrap_or(start)..range_end_last_bucket.unwrap_or(end)
}
}
}
/// Configuration for a [`LogHistogram`]
///
/// The log-scaled histogram implements an H2 histogram where the first bucket covers
/// the range from 0 to [`LogHistogramBuilder::min_value`] and the final bucket covers
/// [... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:5 | /// Set the precision for this histogram
///
/// This function determines the smallest value of `p` that would satisfy the requested precision
/// such that `2^-p` is less than `precision`. To set `p` directly, use
/// [`LogHistogramBuilder::precision_exact`].
///
/// Precision controls the size... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:6 | /// - `p` > 10
///
/// [`HistogramScale::Log`]: [crate::runtime::HistogramScale]
pub fn precision_exact(mut self, p: u32) -> Self {
assert!(p <= MAX_PRECISION, "precision must be <= {MAX_PRECISION}");
self.precision = Some(p);
self
}
/// Sets the minimum duration that can be... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:7 | return Err(InvalidHistogramConfiguration::TooManyBuckets {
required_bucket_count: histogram.num_buckets,
});
}
Ok(histogram)
}
/// Builds the log histogram
pub fn build(&self) -> LogHistogram {
let requested_max_value = duration_as_u64(self.max_value.unwr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:8 | }
impl Error for InvalidHistogramConfiguration {}
/// Compute the index for a given value + p combination
///
/// This function does NOT enforce that the value is within the number of expected buckets.
fn bucket_index(value: u64, p: u32) -> u64 {
// Algorithm described here: https://iop.systems/blog/h2-histogram/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:9 | LogHistogram::from_n_p(n, p, bucket_offset.min(base.num_buckets - 1))
})
}
fn log_histogram_settings() -> impl Strategy<Value = (u64, u64, u32)> {
(
duration_as_u64(Duration::from_nanos(1))..duration_as_u64(Duration::from_secs(20)),
duration_as_u6... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:10 | #[test]
fn proptest_log_histogram_invariants(histogram in valid_log_histogram_strategy()) {
// 1. Assert that the first bucket always starts at 0
let first_range = histogram.bucket_range(0);
prop_assert_eq!(first_range.start, 0, "First bucket doesn't start at ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:11 | }
prev_end = range.end;
prev_size = size;
}
prop_assert_eq!(prev_end, u64::MAX, "Last bucket should end at u64::MAX");
// Check bijection between value_to_bucket and bucket_range
for bucket in 0..histogram.num_buck... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:12 | }
let mut value = 2_usize.pow(p + 1);
let current_bucket = value;
while value < current_bucket * 2 {
assert_eq!(
config.value_to_bucket(value as u64),
current_bucket + ((value - current_bucket) / 2),
"bucket for {value}"
);... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:13 | },
T {
v: 2052,
bucket: 1537,
},
];
for test in tests {
assert_eq!(config.value_to_bucket(test.v), test.bucket);
}
}
#[test]
fn last_bucket_goes_to_infinity() {
let conf = HistogramType::H2(LogHistogram::fro... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 481 | 532 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:14 | required_bucket_count,
} => required_bucket_count,
};
assert_eq!(num_buckets, 27291);
}
#[test]
fn default_configuration_size() {
let conf = LogHistogram::builder().build();
assert_eq!(conf.num_buckets, 119);
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | d41d49d202708a6846e5de023962a8ee17358ba6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d41d49d202708a6846e5de023962a8ee17358ba6/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 521 | 532 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:4 | range_start_0th_bucket.unwrap_or(start)..range_end_last_bucket.unwrap_or(end)
}
}
}
/// Configuration for a [`LogHistogram`]
///
/// The log-scaled histogram implements an H2 histogram where the first bucket covers
/// the range from 0 to [`LogHistogramBuilder::min_value`] and the final bucket covers
/// [... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | 15495fd88305099d4ffa0a5583f6d8856d728ac3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:5 | /// Set the precision for this histogram
///
/// This function determines the smallest value of `p` that would satisfy the requested precision
/// such that `2^-p` is less than `precision`. To set `p` directly, use
/// [`LogHistogramBuilder::precision_exact`].
///
/// Precision controls the size... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | 15495fd88305099d4ffa0a5583f6d8856d728ac3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:1 | use crate::runtime::metrics::batch::duration_as_u64;
use std::cmp;
use std::error::Error;
use std::fmt::{Display, Formatter};
use std::time::Duration;
const DEFAULT_MIN_VALUE: Duration = Duration::from_nanos(100);
const DEFAULT_MAX_VALUE: Duration = Duration::from_secs(60);
/// Default precision is 2^-2 = 25% max err... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:2 | LogHistogramBuilder::default().build()
}
}
impl LogHistogram {
/// Create a Histogram configuration directly from values for `n` and `p`.
///
/// # Panics
/// - If `bucket_offset` is greater than the specified number of buckets, `(n - p + 1) * 2^p`
fn from_n_p(n: u32, p: u32, bucket_offset: usi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:3 | pub(crate) fn bucket_range(&self, bucket: usize) -> std::ops::Range<u64> {
let LogHistogram {
p,
bucket_offset,
num_buckets,
} = self;
let input_bucket = bucket;
let bucket = bucket + bucket_offset;
let range_start_0th_bucket = match input_buck... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:4 | /// the range from 0 to [`LogHistogramBuilder::min_value`] and the final bucket covers
/// [`LogHistogramBuilder::max_value`] to infinity. The precision is bounded to the specified
/// [`LogHistogramBuilder::max_error`]. Specifically, the precision is the next smallest value
/// of `2^-p` such that it is smaller than t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:5 | /// less than this will be truncated.
///
/// # Panics
/// - `precision` < 0
/// - `precision` > 1
pub fn max_error(mut self, max_error: f64) -> Self {
if max_error < 0.0 {
panic!("precision must be >= 0");
};
if max_error > 1.0 {
panic!("precision mus... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:6 | /// sometimes quite significantly.
pub fn min_value(mut self, duration: Duration) -> Self {
self.min_value = Some(duration);
self
}
/// Sets the maximum value that can by this histogram without truncation
///
/// Values greater than this fall in the final bucket that stretches to `u... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:7 | // determine the bucket offset by finding the bucket for the minimum value. We need to lower
// this by one to ensure we are at least as granular as requested.
let bucket_offset = cmp::max(bucket_index(min_value, p), 1) - 1;
// n must be at least as large as p
let n = max_value.ilog2().m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:8 | if h <= p {
value
} else {
let w = h - p;
((w + 1) * (1_u32 << p)) as u64 + ((value - (1_u64 << h)) >> w)
}
}
#[cfg(test)]
mod test {
use super::InvalidHistogramConfiguration;
use crate::runtime::metrics::histogram::h2_histogram::LogHistogram;
use crate::runtime::metrics::hi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:9 | prop_assert!(range.start < range.end, "Bucket range is empty or reversed");
let size = range.end - range.start;
// 2. Assert that the sizes of the buckets are always powers of 2
if bucket > 0 && bucket < histogram.num_buckets - 1 {
pr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:10 | histogram.value_to_bucket(value),
bucket,
"value_to_bucket is not consistent with bucket_range"
);
}
}
}
}
}
#[test]
fn bucket_ranges_are_correct() {
let p = 2;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:11 | }
// test buckets against known values
#[test]
fn bucket_computation_spot_check() {
let p = 9;
let config = HistogramType::H2(LogHistogram {
num_buckets: 4096,
p,
bucket_offset: 0,
});
struct T {
v: u64,
bucket: usi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/metrics/histogram/h2_histogram.rs:12 | fn last_bucket_goes_to_infinity() {
let conf = HistogramType::H2(LogHistogram::from_n_p(16, 3, 10));
assert_eq!(conf.bucket_range(conf.num_buckets() - 1).end, u64::MAX);
}
#[test]
fn bucket_offset() {
// skip the first 10 buckets
let conf = HistogramType::H2(LogHistogram::fr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/histogram/h2_histogram.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/histogram/h2_histogram.rs | 441 | 480 |
tokio-rs/tokio:tokio/src/runtime/metrics/io.rs:1 | #![cfg_attr(not(feature = "net"), allow(dead_code))]
use crate::util::metric_atomics::MetricAtomicU64;
use std::sync::atomic::Ordering::Relaxed;
#[derive(Default)]
pub(crate) struct IoDriverMetrics {
pub(super) fd_registered_count: MetricAtomicU64,
pub(super) fd_deregistered_count: MetricAtomicU64,
pub(su... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/io.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/io.rs | 1 | 25 |
tokio-rs/tokio:tokio/src/runtime/metrics/io.rs:1 | #![cfg_attr(not(feature = "net"), allow(dead_code))]
use crate::{loom::sync::atomic::Ordering::Relaxed, util::metric_atomics::MetricAtomicU64};
#[derive(Default)]
pub(crate) struct IoDriverMetrics {
pub(super) fd_registered_count: MetricAtomicU64,
pub(super) fd_deregistered_count: MetricAtomicU64,
pub(sup... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/io.rs | MIT | cba86cf1b1edea8cd131f168a99953e6e35739d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cba86cf1b1edea8cd131f168a99953e6e35739d2/tokio/src/runtime/metrics/io.rs | 1 | 24 |
tokio-rs/tokio:tokio/src/runtime/metrics/io.rs:1 | #![cfg_attr(not(feature = "net"), allow(dead_code))]
use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed};
#[derive(Default)]
pub(crate) struct IoDriverMetrics {
pub(super) fd_registered_count: AtomicU64,
pub(super) fd_deregistered_count: AtomicU64,
pub(super) ready_count: AtomicU64,
}
impl IoDr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/io.rs | MIT | 6c0a9942ba5dd896a350d854020d01080700ec66 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6c0a9942ba5dd896a350d854020d01080700ec66/tokio/src/runtime/metrics/io.rs | 1 | 24 |
tokio-rs/tokio:tokio/src/runtime/metrics/io.rs:1 | #![cfg_attr(not(feature = "net"), allow(dead_code))]
use crate::loom::sync::atomic::{AtomicU64, Ordering::Relaxed};
#[derive(Default)]
pub(crate) struct IoDriverMetrics {
pub(super) fd_registered_count: AtomicU64,
pub(super) fd_deregistered_count: AtomicU64,
pub(super) ready_count: AtomicU64,
}
impl IoDr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/io.rs | MIT | dc54aec1c785e334c23a0c8f249e71a8241f0d1d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dc54aec1c785e334c23a0c8f249e71a8241f0d1d/tokio/src/runtime/metrics/io.rs | 1 | 30 |
tokio-rs/tokio:tokio/src/runtime/metrics/io.rs:1 | #![cfg_attr(not(feature = "net"), allow(dead_code))]
use std::sync::atomic::{AtomicU64, Ordering::Relaxed};
#[derive(Default)]
pub(crate) struct IoDriverMetrics {
pub(super) fd_registered_count: AtomicU64,
pub(super) fd_deregistered_count: AtomicU64,
pub(super) ready_count: AtomicU64,
}
impl IoDriverMetr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/io.rs | MIT | 769fb1547fc50406fc2adb23cdf17a1aaf5744ac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/769fb1547fc50406fc2adb23cdf17a1aaf5744ac/tokio/src/runtime/metrics/io.rs | 1 | 30 |
tokio-rs/tokio:tokio/src/runtime/metrics/mock.rs:1 | //! This file contains mocks of the types in src/runtime/metrics
pub(crate) struct SchedulerMetrics {}
#[derive(Clone, Default)]
pub(crate) struct HistogramBuilder {}
impl SchedulerMetrics {
pub(crate) fn new() -> Self {
Self {}
}
/// Increment the number of tasks scheduled externally
pub(cr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/mock.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/mock.rs | 1 | 15 |
tokio-rs/tokio:tokio/src/runtime/metrics/mock.rs:1 | //! This file contains mocks of the types in src/runtime/metrics
use std::thread::ThreadId;
pub(crate) struct SchedulerMetrics {}
pub(crate) struct WorkerMetrics {}
pub(crate) struct MetricsBatch {}
#[derive(Clone, Default)]
pub(crate) struct HistogramBuilder {}
impl SchedulerMetrics {
pub(crate) fn new() -> ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/mock.rs | MIT | 90b23a9584db99ae81fffee38a89a09d2eca1834 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/90b23a9584db99ae81fffee38a89a09d2eca1834/tokio/src/runtime/metrics/mock.rs | 1 | 59 |
tokio-rs/tokio:tokio/src/runtime/metrics/mock.rs:1 | //! This file contains mocks of the types in src/runtime/metrics
pub(crate) struct SchedulerMetrics {}
pub(crate) struct WorkerMetrics {}
pub(crate) struct MetricsBatch {}
#[derive(Clone, Default)]
pub(crate) struct HistogramBuilder {}
impl SchedulerMetrics {
pub(crate) fn new() -> Self {
Self {}
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/mock.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/metrics/mock.rs | 1 | 56 |
tokio-rs/tokio:tokio/src/runtime/metrics/mock.rs:1 | //! This file contains mocks of the types in src/runtime/metrics
pub(crate) struct SchedulerMetrics {}
pub(crate) struct WorkerMetrics {}
pub(crate) struct MetricsBatch {}
#[derive(Clone, Default)]
pub(crate) struct HistogramBuilder {}
impl SchedulerMetrics {
pub(crate) fn new() -> Self {
Self {}
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/mock.rs | MIT | 6cb106c3538cf527495ef5491c088d1365b14c8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6cb106c3538cf527495ef5491c088d1365b14c8e/tokio/src/runtime/metrics/mock.rs | 1 | 55 |
tokio-rs/tokio:tokio/src/runtime/metrics/mock.rs:1 | //! This file contains mocks of the types in src/runtime/metrics
pub(crate) struct SchedulerMetrics {}
pub(crate) struct WorkerMetrics {}
pub(crate) struct MetricsBatch {}
#[derive(Clone, Default)]
pub(crate) struct HistogramBuilder {}
impl SchedulerMetrics {
pub(crate) fn new() -> Self {
Self {}
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/mock.rs | MIT | 79a7e78c0d4ea5f36d74a773b9023df7d6022b27 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/metrics/mock.rs | 1 | 55 |
tokio-rs/tokio:tokio/src/runtime/metrics/mock.rs:1 | //! This file contains mocks of the types in src/runtime/metrics
pub(crate) struct SchedulerMetrics {}
pub(crate) struct WorkerMetrics {}
pub(crate) struct MetricsBatch {}
#[derive(Clone, Default)]
pub(crate) struct HistogramBuilder {}
impl SchedulerMetrics {
pub(crate) fn new() -> Self {
Self {}
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/mock.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/metrics/mock.rs | 1 | 54 |
tokio-rs/tokio:tokio/src/runtime/metrics/mock.rs:1 | //! This file contains mocks of the types in src/runtime/metrics
pub(crate) struct SchedulerMetrics {}
pub(crate) struct WorkerMetrics {}
pub(crate) struct MetricsBatch {}
impl SchedulerMetrics {
pub(crate) fn new() -> Self {
Self {}
}
/// Increment the number of tasks scheduled externally
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/mock.rs | MIT | 1f50c57185d28a1d118adc22bf587541e3b7edcc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1f50c57185d28a1d118adc22bf587541e3b7edcc/tokio/src/runtime/metrics/mock.rs | 1 | 44 |
tokio-rs/tokio:tokio/src/runtime/metrics/mock.rs:1 | //! This file contains mocks of the types in src/runtime/metrics
pub(crate) struct SchedulerMetrics {}
pub(crate) struct WorkerMetrics {}
pub(crate) struct MetricsBatch {}
impl SchedulerMetrics {
pub(crate) fn new() -> Self {
Self {}
}
/// Increment the number of tasks scheduled externally
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/mock.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/metrics/mock.rs | 1 | 43 |
tokio-rs/tokio:tokio/src/runtime/metrics/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/metrics/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/mod.rs | 1 | 40 |
tokio-rs/tokio:tokio/src/runtime/metrics/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/metrics/mod.rs | MIT | da745ff335dea94378f5ba2b79e2c9f97cb217aa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/metrics/mod.rs | 1 | 40 |
tokio-rs/tokio:tokio/src/runtime/metrics/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/metrics/mod.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/metrics/mod.rs | 1 | 40 |
tokio-rs/tokio:tokio/src/runtime/metrics/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/metrics/mod.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/metrics/mod.rs | 1 | 40 |
tokio-rs/tokio:tokio/src/runtime/metrics/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/metrics/mod.rs | MIT | 769fb1547fc50406fc2adb23cdf17a1aaf5744ac | github | async-runtime | https://github.com/tokio-rs/tokio/blob/769fb1547fc50406fc2adb23cdf17a1aaf5744ac/tokio/src/runtime/metrics/mod.rs | 1 | 35 |
tokio-rs/tokio:tokio/src/runtime/metrics/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/metrics/mod.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/metrics/mod.rs | 1 | 30 |
tokio-rs/tokio:tokio/src/runtime/metrics/scheduler.rs:1 | use crate::loom::sync::atomic::Ordering::Relaxed;
use crate::util::metric_atomics::MetricAtomicU64;
/// 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] ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/scheduler.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/scheduler.rs | 1 | 35 |
tokio-rs/tokio:tokio/src/runtime/metrics/scheduler.rs:1 | 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]: crat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/scheduler.rs | MIT | 52da177dea169aa9f3dac6b1465fa5229a9615bb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/52da177dea169aa9f3dac6b1465fa5229a9615bb/tokio/src/runtime/metrics/scheduler.rs | 1 | 34 |
tokio-rs/tokio:tokio/src/runtime/metrics/scheduler.rs:1 | 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]: crat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/scheduler.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/metrics/scheduler.rs | 1 | 27 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::runtime::Config;
use crate::util::metric_atomics::{MetricAtomicU64, MetricAtomicUsize};
use std::sync::atomic::Ordering::Relaxed;
use std::sync::Mutex;
use std::thread::ThreadId;
cfg_unstable_metrics! {
use crate::runtime::metrics::Histogram;
}
/// Retrieve runtime worker metrics.
///
/// **Note**: Thi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | #[cfg(tokio_unstable)]
/// Number of tasks the worker stole.
pub(crate) steal_count: MetricAtomicU64,
#[cfg(tokio_unstable)]
/// Number of times the worker stole
pub(crate) steal_operations: MetricAtomicU64,
#[cfg(tokio_unstable)]
/// Number of tasks the worker polled.
pub(crate) poll_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/worker.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:3 | }
cfg_metrics_variant! {
stable: {
pub(crate) fn from_config(_: &Config) -> WorkerMetrics {
WorkerMetrics::new()
}
},
unstable: {
pub(crate) fn from_config(config: &Config) -> WorkerMetrics {
let mut worker_metrics = Worker... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/metrics/worker.rs | 81 | 110 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::runtime::Config;
use crate::util::metric_atomics::{MetricAtomicU64, MetricAtomicUsize};
use std::sync::atomic::Ordering::Relaxed;
use std::sync::Mutex;
use std::thread::ThreadId;
cfg_unstable_metrics! {
use crate::runtime::metrics::Histogram;
}
/// Retrieve runtime worker metrics.
///
/// **Note**: Thi... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | afd3678f89dd0253af9194a4945711cfd3c0662a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/afd3678f89dd0253af9194a4945711cfd3c0662a/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | pub(crate) noop_count: MetricAtomicU64,
#[cfg(tokio_unstable)]
/// Number of tasks the worker stole.
pub(crate) steal_count: MetricAtomicU64,
#[cfg(tokio_unstable)]
/// Number of times the worker stole
pub(crate) steal_operations: MetricAtomicU64,
#[cfg(tokio_unstable)]
/// Number of ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | afd3678f89dd0253af9194a4945711cfd3c0662a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/afd3678f89dd0253af9194a4945711cfd3c0662a/tokio/src/runtime/metrics/worker.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:3 | pub(crate) fn set_thread_id(&self, thread_id: ThreadId) {
*self.thread_id.lock().unwrap() = Some(thread_id);
}
cfg_metrics_variant! {
stable: {
pub(crate) fn from_config(_: &Config) -> WorkerMetrics {
WorkerMetrics::new()
}
},
unstable: {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | afd3678f89dd0253af9194a4945711cfd3c0662a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/afd3678f89dd0253af9194a4945711cfd3c0662a/tokio/src/runtime/metrics/worker.rs | 81 | 112 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::runtime::metrics::Histogram;
use crate::runtime::Config;
use crate::util::metric_atomics::{MetricAtomicU64, MetricAtomicUsize};
use std::sync::atomic::Ordering::Relaxed;
use std::sync::Mutex;
use std::thread::ThreadId;
/// Retrieve runtime worker metrics.
///
/// **Note**: This is an [unstable API][unstable... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 90b23a9584db99ae81fffee38a89a09d2eca1834 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/90b23a9584db99ae81fffee38a89a09d2eca1834/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | /// Number of tasks scheduled for execution on the worker's local queue.
pub(crate) local_schedule_count: MetricAtomicU64,
/// Number of tasks moved from the local queue to the global queue to free space.
pub(crate) overflow_count: MetricAtomicU64,
/// Number of tasks currently in the local queue. Use... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 90b23a9584db99ae81fffee38a89a09d2eca1834 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/90b23a9584db99ae81fffee38a89a09d2eca1834/tokio/src/runtime/metrics/worker.rs | 41 | 88 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::runtime::metrics::Histogram;
use crate::runtime::Config;
use crate::util::metric_atomics::{MetricAtomicU64, MetricAtomicUsize};
use std::sync::atomic::Ordering::Relaxed;
/// Retrieve runtime worker metrics.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | pub(crate) local_schedule_count: MetricAtomicU64,
/// Number of tasks moved from the local queue to the global queue to free space.
pub(crate) overflow_count: MetricAtomicU64,
/// Number of tasks currently in the local queue. Used only by the
/// current-thread scheduler.
pub(crate) queue_depth: M... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | b69f16aa219818bc75e7ae6a22631d4e574efd39 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b69f16aa219818bc75e7ae6a22631d4e574efd39/tokio/src/runtime/metrics/worker.rs | 41 | 75 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::runtime::metrics::Histogram;
use crate::runtime::Config;
use crate::util::metric_atomics::{MetricAtomicU64, MetricAtomicUsize};
use std::sync::atomic::Ordering::Relaxed;
/// Retrieve runtime worker metrics.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 8e15c234c60cf8132c490ccf03dd31738cfeaca8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e15c234c60cf8132c490ccf03dd31738cfeaca8/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | pub(crate) overflow_count: MetricAtomicU64,
/// Number of tasks currently in the local queue. Used only by the
/// current-thread scheduler.
pub(crate) queue_depth: MetricAtomicUsize,
/// If `Some`, tracks the number of polls by duration range.
pub(super) poll_count_histogram: Option<Histogram>,
}... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 8e15c234c60cf8132c490ccf03dd31738cfeaca8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8e15c234c60cf8132c490ccf03dd31738cfeaca8/tokio/src/runtime/metrics/worker.rs | 41 | 72 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::runtime::metrics::Histogram;
use crate::runtime::Config;
use crate::util::metric_atomics::MetricAtomicU64;
// This is NOT the Loom atomic. To avoid an unnecessary state explosion in loom,
// all metrics use regular atomics.
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering::Relaxed;
/// Re... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | pub(crate) local_schedule_count: MetricAtomicU64,
/// Number of tasks moved from the local queue to the global queue to free space.
pub(crate) overflow_count: MetricAtomicU64,
/// Number of tasks currently in the local queue. Used only by the
/// current-thread scheduler.
pub(crate) queue_depth: A... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 86658bd87dc470f8e36eb6b893cc403820cfb7ee | github | async-runtime | https://github.com/tokio-rs/tokio/blob/86658bd87dc470f8e36eb6b893cc403820cfb7ee/tokio/src/runtime/metrics/worker.rs | 41 | 87 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::loom::sync::atomic::AtomicUsize;
use crate::loom::sync::atomic::Ordering::Relaxed;
use crate::runtime::metrics::Histogram;
use crate::runtime::Config;
use crate::util::metric_atomics::MetricAtomicU64;
/// Retrieve runtime worker metrics.
///
/// **Note**: This is an [unstable API][unstable]. The public API ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | cba86cf1b1edea8cd131f168a99953e6e35739d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cba86cf1b1edea8cd131f168a99953e6e35739d2/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | /// Number of tasks moved from the local queue to the global queue to free space.
pub(crate) overflow_count: MetricAtomicU64,
/// Number of tasks currently in the local queue. Used only by the
/// current-thread scheduler.
pub(crate) queue_depth: AtomicUsize,
/// If `Some`, tracks the number of po... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | cba86cf1b1edea8cd131f168a99953e6e35739d2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cba86cf1b1edea8cd131f168a99953e6e35739d2/tokio/src/runtime/metrics/worker.rs | 41 | 85 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::loom::sync::atomic::Ordering::Relaxed;
use crate::loom::sync::atomic::{AtomicU64, AtomicUsize};
use crate::runtime::metrics::Histogram;
use crate::runtime::Config;
/// Retrieve runtime worker metrics.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1.x rel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 035a968bddcadcbfeff02efa7ccf1f5d9b69f149 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/035a968bddcadcbfeff02efa7ccf1f5d9b69f149/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | pub(crate) overflow_count: AtomicU64,
/// Number of tasks currently in the local queue. Used only by the
/// current-thread scheduler.
pub(crate) queue_depth: AtomicUsize,
/// If `Some`, tracks the number of polls by duration range.
pub(super) poll_count_histogram: Option<Histogram>,
}
impl Worke... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 035a968bddcadcbfeff02efa7ccf1f5d9b69f149 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/035a968bddcadcbfeff02efa7ccf1f5d9b69f149/tokio/src/runtime/metrics/worker.rs | 41 | 84 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::loom::sync::atomic::Ordering::Relaxed;
use crate::loom::sync::atomic::{AtomicU64, AtomicUsize};
use crate::runtime::metrics::Histogram;
use crate::runtime::Config;
/// Retrieve runtime worker metrics.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1.x rel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 6cb106c3538cf527495ef5491c088d1365b14c8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6cb106c3538cf527495ef5491c088d1365b14c8e/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | pub(crate) overflow_count: AtomicU64,
/// Number of tasks currently in the local queue. Used only by the
/// current-thread scheduler.
pub(crate) queue_depth: AtomicUsize,
/// If `Some`, tracks the the number of polls by duration range.
pub(super) poll_count_histogram: Option<Histogram>,
}
impl W... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 6cb106c3538cf527495ef5491c088d1365b14c8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6cb106c3538cf527495ef5491c088d1365b14c8e/tokio/src/runtime/metrics/worker.rs | 41 | 84 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::loom::sync::atomic::Ordering::Relaxed;
use crate::loom::sync::atomic::{AtomicU64, AtomicUsize};
use crate::runtime::metrics::Histogram;
use crate::runtime::Config;
/// Retrieve runtime worker metrics.
///
/// **Note**: This is an [unstable API][unstable]. The public API of this type
/// may break in 1.x rel... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | /// current-thread scheduler.
pub(crate) queue_depth: AtomicUsize,
/// If `Some`, tracks the the number of polls by duration range.
pub(super) poll_count_histogram: Option<Histogram>,
}
impl WorkerMetrics {
pub(crate) fn from_config(config: &Config) -> WorkerMetrics {
let mut worker_metrics = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | c84d0a14b189c45da8f5e963fd3a83790ec92f8e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/metrics/worker.rs | 41 | 80 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::loom::sync::atomic::Ordering::Relaxed;
use crate::loom::sync::atomic::{AtomicU64, AtomicUsize};
/// Retrieve runtime worker metrics.
///
/// **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] fo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 1f50c57185d28a1d118adc22bf587541e3b7edcc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1f50c57185d28a1d118adc22bf587541e3b7edcc/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | }
impl WorkerMetrics {
pub(crate) fn new() -> WorkerMetrics {
WorkerMetrics {
park_count: AtomicU64::new(0),
noop_count: AtomicU64::new(0),
steal_count: AtomicU64::new(0),
steal_operations: AtomicU64::new(0),
poll_count: AtomicU64::new(0),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 1f50c57185d28a1d118adc22bf587541e3b7edcc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1f50c57185d28a1d118adc22bf587541e3b7edcc/tokio/src/runtime/metrics/worker.rs | 41 | 65 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::loom::sync::atomic::Ordering::Relaxed;
use crate::loom::sync::atomic::{AtomicU64, AtomicUsize};
/// Retrieve runtime worker metrics.
///
/// **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] fo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 1472af5bd4e441ed68648660603cffdae55fbdbd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1472af5bd4e441ed68648660603cffdae55fbdbd/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:2 | pub(crate) fn new() -> WorkerMetrics {
WorkerMetrics {
park_count: AtomicU64::new(0),
noop_count: AtomicU64::new(0),
steal_count: AtomicU64::new(0),
poll_count: AtomicU64::new(0),
overflow_count: AtomicU64::new(0),
busy_duration_total: Atom... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 1472af5bd4e441ed68648660603cffdae55fbdbd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1472af5bd4e441ed68648660603cffdae55fbdbd/tokio/src/runtime/metrics/worker.rs | 41 | 61 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use crate::loom::sync::atomic::Ordering::Relaxed;
use crate::loom::sync::atomic::{AtomicU64, AtomicUsize};
/// Retreive runtime worker metrics.
///
/// **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] fo... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 5690f0c32ec2f0ac0d345da1da23178357b28e26 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5690f0c32ec2f0ac0d345da1da23178357b28e26/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/metrics/worker.rs:1 | use std::sync::atomic::Ordering::Relaxed;
use std::sync::atomic::{AtomicU64, AtomicUsize};
/// Retreive runtime worker metrics.
///
/// **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.
///
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/metrics/worker.rs | MIT | 24f4ee31f0266a97547a81f510726da9c1bb9ec9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/24f4ee31f0266a97547a81f510726da9c1bb9ec9/tokio/src/runtime/metrics/worker.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/mod.rs:10 | //! slot instead of being added to a queue. If there was already a task in the
//! lifo slot when this happened, then the lifo slot is replaced, and the task
//! that used to be in the lifo slot is placed in the thread's local queue.
//! When the runtime finishes scheduling a task, it will schedule the task in
//! the ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/mod.rs | 361 | 420 |
tokio-rs/tokio:tokio/src/runtime/mod.rs:11 | mod tests;
pub(crate) mod context;
pub(crate) mod park;
pub(crate) mod driver;
pub(crate) mod scheduler;
cfg_io_driver_impl! {
pub(crate) mod io;
}
cfg_process_driver! {
mod process;
}
#[cfg_attr(not(feature = "time"), allow(dead_code))]
#[derive(Debug, Copy, Clone, PartialEq)]
pub(crate) enum TimerFlavo... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/mod.rs | 401 | 460 |
tokio-rs/tokio:tokio/src/runtime/mod.rs:12 | Alternative(time_alt::Timer),
}
impl Timer {
#[track_caller]
pub(crate) fn new(
handle: crate::runtime::scheduler::Handle,
deadline: crate::time::Instant,
) -> Self {
match handle.timer_flavor() {
crate::runtime::TimerFlavor::Tradition... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/mod.rs | 441 | 500 |
tokio-rs/tokio:tokio/src/runtime/mod.rs:13 | Timer::Alternative(_) => TimerFlavor::Alternative,
}
}
pub(crate) fn reset(
self: Pin<&mut Self>,
new_time: crate::time::Instant,
reregister: bool
) {
// Safety: we never move the inner entries.
let this = unsafe { self.get... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/mod.rs | 481 | 540 |
tokio-rs/tokio:tokio/src/runtime/mod.rs:14 | #[cfg(all(tokio_unstable, feature = "rt-multi-thread"))]
pub(crate) fn scheduler_handle(&self) -> &crate::runtime::scheduler::Handle {
match self {
Timer::Traditional(_) => unreachable!("we should not call this on Traditional Timer"),
#[cfg(all(tokio_unstable, feature... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/mod.rs | 521 | 580 |
tokio-rs/tokio:tokio/src/runtime/mod.rs:15 | #[cfg_attr(target_os = "wasi", allow(unused_imports))]
pub(crate) use blocking::spawn_blocking;
cfg_trace! {
pub(crate) use blocking::Mandatory;
}
cfg_fs! {
pub(crate) use blocking::spawn_mandatory_blocking;
}
mod builder;
pub use self::builder::Builder;
cfg_unstable! ... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/mod.rs | 561 | 620 |
tokio-rs/tokio:tokio/src/runtime/mod.rs:16 | /// # {
/// #[tokio::main(flavor = "multi_thread", worker_threads = 4)]
/// async fn main() {
/// let index = tokio::spawn(async {
/// tokio::runtime::worker_index()
/// }).await.unwrap();
/// println!("Task ran on worker {:?}", index);
/// }
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/runtime/mod.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/mod.rs | 601 | 660 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.