Struct dpc_pariter::TotalTimeProfiler
source · [−]pub struct TotalTimeProfiler<Reporter> { /* private fields */ }
Expand description
A simple basic profiler implementation which tracks the accumulative time and calls a handler function with it.
Example
use dpc_pariter::{IteratorExt, TotalTimeProfiler};
dpc_pariter::scope(|scope| {
(0..22)
.readahead_scoped_profiled(
scope,
TotalTimeProfiler::periodically_millis(10_000, || eprintln!("Blocked on sending")),
TotalTimeProfiler::periodically_millis(10_000, || eprintln!("Blocked on receving")),
)
.for_each(|i| {
println!("{i}");
})
})
.expect("thread panicked");
Implementations
sourceimpl<F> TotalTimeProfiler<F> where
F: for<'a> Fn(&'a mut TotalTimeStats),
impl<F> TotalTimeProfiler<F> where
F: for<'a> Fn(&'a mut TotalTimeStats),
sourcepub fn new(f: F) -> TotalTimeProfiler<F>
pub fn new(f: F) -> TotalTimeProfiler<F>
Create a TotalTimeProfiler
with any handle
Example
use dpc_pariter::{IteratorExt, TotalTimeProfiler};
let profiler = TotalTimeProfiler::new(|stats| eprintln!("accumulative sending time so far: {}", stats.total().as_millis()));
sourceimpl<F> TotalTimeProfiler<PeriodicReporter<F>> where
F: Fn(),
impl<F> TotalTimeProfiler<PeriodicReporter<F>> where
F: Fn(),
pub fn periodically_millis(
millis: u64,
f: F
) -> TotalTimeProfiler<PeriodicReporter<F>>
pub fn periodically(
period: Duration,
f: F
) -> TotalTimeProfiler<PeriodicReporter<F>>
Trait Implementations
sourceimpl<Reporter> Debug for TotalTimeProfiler<Reporter> where
Reporter: Debug,
impl<Reporter> Debug for TotalTimeProfiler<Reporter> where
Reporter: Debug,
Auto Trait Implementations
impl<Reporter> RefUnwindSafe for TotalTimeProfiler<Reporter> where
Reporter: RefUnwindSafe,
impl<Reporter> Send for TotalTimeProfiler<Reporter> where
Reporter: Send,
impl<Reporter> Sync for TotalTimeProfiler<Reporter> where
Reporter: Sync,
impl<Reporter> Unpin for TotalTimeProfiler<Reporter> where
Reporter: Unpin,
impl<Reporter> UnwindSafe for TotalTimeProfiler<Reporter> where
Reporter: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more