feat: statistics flag, commented some more

This commit is contained in:
2025-12-29 20:00:29 -05:00
parent 3f9f3a603f
commit 351faa7e08
8 changed files with 64 additions and 49 deletions

View File

@@ -1,13 +1,14 @@
package statistics
import (
"fmt"
"os"
"time"
)
type Tracker struct {
start time.Time
steps uint64
Results *Results
start time.Time
steps uint64
}
func Track() *Tracker {
@@ -17,7 +18,6 @@ func Track() *Tracker {
func (t *Tracker) Start() {
t.start = time.Now()
t.steps = 0
t.Results = nil
}
func (t *Tracker) Step() {
@@ -25,8 +25,10 @@ func (t *Tracker) Step() {
}
func (t *Tracker) End() {
t.Results = &Results{
results := Results{
StepsTaken: t.steps,
TimeElapsed: uint64(time.Since(t.start).Milliseconds()),
}
fmt.Fprint(os.Stderr, results.String())
}