Skip to main content

error_stopwatch

Macro error_stopwatch 

Source
macro_rules! error_stopwatch {
    ($threshold:expr, $($arg:tt)+) => { ... };
}
Expand description

Creates a Stopwatch that will log an error message if the elapsed time exceeds the threshold.

use local_async_utils::prelude::*;

let sw = error_stopwatch!(sec!(0), "10 milliseconds of sleep");
std::thread::sleep(millisec!(10));
drop(sw); // Logs: "10 milliseconds of sleep finished in 10ms"