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
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:
@@ -84,12 +84,17 @@ func main() {
|
|||||||
flagArch string
|
flagArch string
|
||||||
flagCheck bool
|
flagCheck bool
|
||||||
flagLTO bool
|
flagLTO bool
|
||||||
|
flagET bool
|
||||||
|
|
||||||
flagCrossOverride int
|
flagCrossOverride int
|
||||||
|
|
||||||
addr net.UnixAddr
|
addr net.UnixAddr
|
||||||
)
|
)
|
||||||
c := command.New(os.Stderr, log.Printf, "mbf", func([]string) error {
|
c := command.New(os.Stderr, log.Printf, "mbf", func([]string) error {
|
||||||
|
if flagET {
|
||||||
|
log.Println("evaluated in", rosa.EvalTime())
|
||||||
|
}
|
||||||
|
|
||||||
msg.SwapVerbose(!flagQuiet)
|
msg.SwapVerbose(!flagQuiet)
|
||||||
cm.ctx, cm.msg = ctx, msg
|
cm.ctx, cm.msg = ctx, msg
|
||||||
cm.base = os.ExpandEnv(cm.base)
|
cm.base = os.ExpandEnv(cm.base)
|
||||||
@@ -183,6 +188,10 @@ func main() {
|
|||||||
&addr.Name,
|
&addr.Name,
|
||||||
"socket", command.StringFlag("$MBF_DAEMON_SOCKET"),
|
"socket", command.StringFlag("$MBF_DAEMON_SOCKET"),
|
||||||
"Pathname of socket to bind to",
|
"Pathname of socket to bind to",
|
||||||
|
).Flag(
|
||||||
|
&flagET,
|
||||||
|
"eval-time", command.BoolFlag(false),
|
||||||
|
"Print duration of the initial azalea evaluation",
|
||||||
)
|
)
|
||||||
|
|
||||||
c.NewCommand(
|
c.NewCommand(
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"hakurei.app/fhs"
|
"hakurei.app/fhs"
|
||||||
"hakurei.app/internal/pkg"
|
"hakurei.app/internal/pkg"
|
||||||
@@ -612,6 +613,12 @@ var native S
|
|||||||
// Native returns the global [S].
|
// Native returns the global [S].
|
||||||
func Native() *S { return &native }
|
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]
|
// nativeB is the backing directory of built-in azalea-based [Artifact]
|
||||||
// implementations.
|
// implementations.
|
||||||
//
|
//
|
||||||
@@ -623,8 +630,10 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
t := time.Now()
|
||||||
if err = native.EvaluateFS(sub); err != nil {
|
if err = native.EvaluateFS(sub); err != nil {
|
||||||
println(err.Error())
|
println(err.Error())
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
evalTime = time.Since(t)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user