feat: rename profiler to performance, typeless event emitter

This commit is contained in:
2025-12-29 01:15:14 -05:00
parent c2b397a9f6
commit a2ce5b6897
6 changed files with 80 additions and 80 deletions

View File

@@ -2,29 +2,31 @@ package statistics
import (
"time"
"git.maximhutz.com/max/lambda/pkg/lambda"
)
type Profiler struct {
type Tracker struct {
start time.Time
steps uint64
Results *Results
}
func (p *Profiler) Start(*lambda.Expression) {
p.start = time.Now()
p.steps = 0
p.Results = nil
func Track() *Tracker {
return &Tracker{}
}
func (p *Profiler) Step(*lambda.Expression) {
p.steps++
func (t *Tracker) Start() {
t.start = time.Now()
t.steps = 0
t.Results = nil
}
func (p *Profiler) End(*lambda.Expression) {
p.Results = &Results{
StepsTaken: p.steps,
TimeElapsed: uint64(time.Since(p.start).Milliseconds()),
func (t *Tracker) Step() {
t.steps++
}
func (t *Tracker) End() {
t.Results = &Results{
StepsTaken: t.steps,
TimeElapsed: uint64(time.Since(t.start).Milliseconds()),
}
}