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

View File

@@ -1,6 +1,6 @@
use std::time::Instant;
use anyhow::Result;
use common::instrument;
use std::time::Instant;
const INPUT: &str = include_str!("input/input.txt");
@@ -41,13 +41,7 @@ fn solve_part2(input: &str) -> Result<i32> {
}
fn main() {
let mut now = Instant::now();
println!("Part 1: {}", solve_part1(INPUT).unwrap());
println!("(elapsed: {:?})", now.elapsed());
now = Instant::now();
println!("");
println!("Part 2: {}", solve_part2(INPUT).unwrap());
println!("(elapsed: {:?})", now.elapsed());
instrument!(solve_part1(INPUT).unwrap(), solve_part2(INPUT).unwrap());
}
#[cfg(test)]