mirror of
https://github.com/bdnugget/AoC_2024.git
synced 2026-11-07 03:37:27 +00:00
Add functionality to run and time all days
This commit is contained in:
1 parent
38b842213c
commit
842dd4ec8a
6 files changed
+23
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/bdnugget/AoC_2024/day01"
|
||||
)
|
||||
|
||||
func measureAndPrint[T any](label string, fn func() T) {
|
||||
startTime := time.Now()
|
||||
res := fn()
|
||||
endTime := time.Now()
|
||||
elapsed := endTime.Sub(startTime)
|
||||
fmt.Printf("%s: %-15v\t(%v)\n", label, res, elapsed)
|
||||
}
|
||||
|
||||
func main() {
|
||||
measureAndPrint("Day 01 part 01", day01.Part01)
|
||||
}
|
||||
Reference in new issue
Block a user