Use a common macro to instrument each part

This commit is contained in:
2021-12-01 01:26:04 -05:00
parent 200daf7336
commit 5fb0095dc6
5 changed files with 31 additions and 9 deletions

14
crates/common/src/lib.rs Normal file
View 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());
};
}