pub struct TimeReporter { /* private fields */ }
Expand description
Collect and report total time spent on set of activities
TimeReporter
is useful for generating and reporting
time reports: how much time was spend on a given activity.
On drop
or on call to finish
it will report total times
gathered to slog::Logger
.
Implementations§
Source§impl TimeReporter
impl TimeReporter
Sourcepub fn new_with_level<S: Into<String>>(
name: S,
log: Logger,
level: Level,
) -> TimeReporter
pub fn new_with_level<S: Into<String>>( name: S, log: Logger, level: Level, ) -> TimeReporter
Create new TimeReporter
Sourcepub fn start(&mut self, key: &'static str)
pub fn start(&mut self, key: &'static str)
Start counting time for a state named “key”
If this the TimeReporter
was already counting time
for another state, it will end counting time for it
before starting new one.
Sourcepub fn start_with<F, R>(&mut self, key: &'static str, f: F) -> Rwhere
F: FnOnce() -> R,
pub fn start_with<F, R>(&mut self, key: &'static str, f: F) -> Rwhere
F: FnOnce() -> R,
Start counting time and execute a function f
This is handy syntax for if let
or while let
expressions
where it would be inconvenient to add standalone start
call.
pub fn stop(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TimeReporter
impl RefUnwindSafe for TimeReporter
impl Send for TimeReporter
impl Sync for TimeReporter
impl Unpin for TimeReporter
impl UnwindSafe for TimeReporter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more