Skip to content

Commit

Permalink
Add Debug implementations. (#28)
Browse files Browse the repository at this point in the history
Fixes #23
  • Loading branch information
jswrenn authored Aug 9, 2022
1 parent 88a97b0 commit 96c5167
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ use std::time::{Duration, Instant};
/// }
/// }
/// ```
#[derive(Debug)]
pub struct RuntimeMonitor {
/// Handle to the runtime
runtime: runtime::RuntimeMetrics,
Expand Down Expand Up @@ -944,6 +945,7 @@ pub struct RuntimeMetrics {
}

/// Snapshot of per-worker metrics
#[derive(Debug)]
struct Worker {
worker: usize,
total_park_count: u64,
Expand All @@ -958,6 +960,7 @@ struct Worker {
/// Iterator returned by [`RuntimeMonitor::intervals`].
///
/// See that method's documentation for more details.
#[derive(Debug)]
pub struct RuntimeIntervals {
runtime: runtime::RuntimeMetrics,
started_at: Instant,
Expand Down
5 changes: 4 additions & 1 deletion src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,13 +498,14 @@ use std::time::{Duration, Instant};
/// ```
/// If a cumulative metric overflows *more than once* in the midst of an interval,
/// its interval-sampled counterpart will also overflow.
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct TaskMonitor {
metrics: Arc<RawMetrics>,
}

pin_project! {
/// An async task that has been instrumented with [`TaskMonitor::instrument`].
#[derive(Debug)]
pub struct Instrumented<T> {
// The task being instrumented
#[pin]
Expand Down Expand Up @@ -1322,6 +1323,7 @@ pub struct TaskMetrics {
}

/// Tracks the metrics, shared across the various types.
#[derive(Debug)]
struct RawMetrics {
/// A task poll takes longer than this, it is considered a slow poll.
slow_poll_threshold: Duration,
Expand Down Expand Up @@ -1363,6 +1365,7 @@ struct RawMetrics {
total_slow_poll_duration: AtomicU64,
}

#[derive(Debug)]
struct State {
/// Where metrics should be recorded
metrics: Arc<RawMetrics>,
Expand Down

0 comments on commit 96c5167

Please # to comment.