Use a common macro to instrument each part
This commit is contained in:
14
crates/common/src/lib.rs
Normal file
14
crates/common/src/lib.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use std::time::Instant;
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! instrument {
|
||||
($part1:expr, $part2:expr) => {
|
||||
let mut now = Instant::now();
|
||||
println!("Part 1: {}", $part1);
|
||||
println!("(elapsed: {:?})", now.elapsed());
|
||||
now = Instant::now();
|
||||
println!("");
|
||||
println!("Part 2: {}", $part2);
|
||||
println!("(elapsed: {:?})", now.elapsed());
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user