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,
0,
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
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()));