Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions tests/reexecute/c/vm_reexecute.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/ava-labs/avalanchego/tests/reexecute"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/perms"
"github.com/ava-labs/avalanchego/utils/profiler"
"github.com/ava-labs/avalanchego/utils/timer"
)

Expand All @@ -42,6 +43,7 @@ var (
executionTimeout time.Duration
labelsArg string

pprofDirArg string
metricsServerEnabledArg bool
metricsServerPortArg uint64
metricsCollectorEnabledArg bool
Expand Down Expand Up @@ -92,6 +94,7 @@ func init() {
flag.IntVar(&chanSizeArg, "chan-size", 100, "Size of the channel to use for block processing.")
flag.DurationVar(&executionTimeout, "execution-timeout", 0, "Benchmark execution timeout. After this timeout has elapsed, terminate the benchmark without error. If 0, no timeout is applied.")

flag.StringVar(&pprofDirArg, "pprof-dir", "", "Directory to write cpu, mem, and lock profiles. Empty to disable.")
flag.BoolVar(&metricsServerEnabledArg, "metrics-server-enabled", false, "Whether to enable the metrics server.")
flag.Uint64Var(&metricsServerPortArg, "metrics-server-port", 0, "The port the metrics server will listen to.")
flag.BoolVar(&metricsCollectorEnabledArg, "metrics-collector-enabled", false, "Whether to enable the metrics collector (if true, then metrics-server-enabled must be true as well).")
Expand Down Expand Up @@ -205,20 +208,33 @@ func benchmarkReexecuteRange(
)

log := tc.Log()
log.Info("re-executing block range with params",
logFields := []zap.Field{
zap.String("runner", runnerTypeArg),
zap.String("config", configNameArg),
zap.String("labels", labelsArg),
zap.String("metrics-server-enabled", strconv.FormatBool(metricsServerEnabled)),
zap.Bool("metrics-server-enabled", metricsServerEnabled),
zap.Uint64("metrics-server-port", metricsPort),
zap.String("metrics-collector-enabled", strconv.FormatBool(metricsCollectorEnabled)),
zap.Bool("metrics-collector-enabled", metricsCollectorEnabled),
zap.String("block-dir", blockDir),
zap.String("vm-db-dir", vmDBDir),
zap.String("chain-data-dir", chainDataDir),
zap.Uint64("start-block", startBlock),
zap.Uint64("end-block", endBlock),
zap.Int("chan-size", chanSize),
)
}

if pprofDirArg != "" {
p := profiler.New(pprofDirArg)
r.NoError(p.StartCPUProfiler())
defer func() {
r.NoError(p.StopCPUProfiler())
r.NoError(p.MemoryProfile())
r.NoError(p.LockProfile())
}()

logFields = append(logFields, zap.String("pprof-dir", pprofDirArg))
}
log.Info("re-executing block range with params", logFields...)

blockChan, err := reexecute.CreateBlockChanFromLevelDB(tc, blockDir, startBlock, endBlock, chanSize)
r.NoError(err)
Expand Down