feat: added optional profiling

This commit is contained in:
2025-12-28 22:52:10 -05:00
parent a4c049c0ff
commit e9dc3fe171
8 changed files with 124 additions and 77 deletions

View File

@@ -0,0 +1,23 @@
package executer
import (
"fmt"
"strings"
)
type Results struct {
StepsTaken uint64 // Number of steps taken during execution.
TimeElapsed uint64 // The time (ms) taken for execution to complete.
}
func (r Results) OpsPerSecond() float32 {
return float32(r.StepsTaken) / (float32(r.TimeElapsed) / 1000)
}
func (r Results) String() string {
builder := strings.Builder{}
fmt.Fprintln(&builder, "Time Spent:", r.TimeElapsed, "ms")
fmt.Fprintln(&builder, "Steps:", r.StepsTaken)
fmt.Fprintln(&builder, "Speed:", r.OpsPerSecond(), "ops")
return builder.String()
}