internal/rosa: track evaluation time
All checks were successful
Test / Create distribution (push) Successful in 1m5s
Test / Sandbox (push) Successful in 2m49s
Test / ShareFS (push) Successful in 3m45s
Test / Sandbox (race detector) (push) Successful in 5m22s
Test / Hakurei (race detector) (push) Successful in 6m28s
Test / Hakurei (push) Successful in 2m47s
Test / Flake checks (push) Successful in 1m30s

Useful to track performance regressions over migrations.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-05-18 22:18:09 +09:00
parent 594221eb78
commit 682b3a2ce5
2 changed files with 18 additions and 0 deletions

View File

@@ -84,12 +84,17 @@ func main() {
flagArch string
flagCheck bool
flagLTO bool
flagET bool
flagCrossOverride int
addr net.UnixAddr
)
c := command.New(os.Stderr, log.Printf, "mbf", func([]string) error {
if flagET {
log.Println("evaluated in", rosa.EvalTime())
}
msg.SwapVerbose(!flagQuiet)
cm.ctx, cm.msg = ctx, msg
cm.base = os.ExpandEnv(cm.base)
@@ -183,6 +188,10 @@ func main() {
&addr.Name,
"socket", command.StringFlag("$MBF_DAEMON_SOCKET"),
"Pathname of socket to bind to",
).Flag(
&flagET,
"eval-time", command.BoolFlag(false),
"Print duration of the initial azalea evaluation",
)
c.NewCommand(

View File

@@ -10,6 +10,7 @@ import (
"strconv"
"strings"
"sync"
"time"
"hakurei.app/fhs"
"hakurei.app/internal/pkg"
@@ -612,6 +613,12 @@ var native S
// Native returns the global [S].
func Native() *S { return &native }
// evalTime is the duration of the initial built-in evaluation.
var evalTime time.Duration
// EvalTime returns the duration of the initial built-in evaluation.
func EvalTime() time.Duration { return evalTime }
// nativeB is the backing directory of built-in azalea-based [Artifact]
// implementations.
//
@@ -623,8 +630,10 @@ func init() {
if err != nil {
panic(err)
}
t := time.Now()
if err = native.EvaluateFS(sub); err != nil {
println(err.Error())
os.Exit(1)
}
evalTime = time.Since(t)
}