4 releases
new 0.1.3 | Nov 21, 2024 |
---|---|
0.1.2 | Oct 31, 2024 |
0.1.1 | Oct 30, 2024 |
0.1.0 | Oct 30, 2024 |
#14 in #execution-time
502 downloads per month
4KB
logtime
Logtime is a Rust library for measuring and optionally logging the execution time of code.
Usage
Add logtime to your Cargo.toml
:
[dependencies]
logtime = "0.1.0"
Examples
use logtime::{time_execution, log_execution_time};
fn main() {
let (_, duration) = time_execution(|| {
// code to time
std::thread::sleep(std::time::Duration::from_millis(100));
});
println!("Code block took {:?}", duration);
log_execution_time("sleep_200ms", || {
std::thread::sleep(std::time::Duration::from_millis(200));
});
}
License
This project is licensed under the MIT License
Author
bensatlantik