Struct slog_perf::TimeReporter
[−]
[src]
pub struct TimeReporter { /* fields omitted */ }
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
.
Methods
impl TimeReporter
[src]
fn new<S: Into<String>>(name: S, log: Logger) -> TimeReporter
[src]
Create new TimeReporter
fn new_with_level<S: Into<String>>(
name: S,
log: Logger,
level: Level
) -> TimeReporter
[src]
name: S,
log: Logger,
level: Level
) -> TimeReporter
Create new TimeReporter
fn start(&mut self, key: &'static str)
[src]
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.
fn start_with<F, R>(&mut self, key: &'static str, f: F) -> R where
F: FnOnce() -> R,
[src]
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.
fn stop(&mut self)
[src]
fn finish(self)
[src]
Finish counting time and report results