Commit 32c76db4 authored by protolambda's avatar protolambda

cmd: make pprof optional

parent 1741146c
......@@ -76,6 +76,10 @@ var (
Value: MustStepMatcherFlag("%100000"),
Required: false,
}
RunPProfCPU = &cli.BoolFlag{
Name: "pprof.cpu",
Usage: "enable pprof cpu profiling",
}
)
type Proof struct {
......@@ -192,7 +196,9 @@ func Guard(proc *os.ProcessState, fn StepFn) StepFn {
var _ mipsevm.PreimageOracle = (*ProcessPreimageOracle)(nil)
func Run(ctx *cli.Context) error {
defer profile.Start(profile.NoShutdownHook, profile.ProfilePath("."), profile.CPUProfile).Stop()
if ctx.Bool(RunPProfCPU.Name) {
defer profile.Start(profile.NoShutdownHook, profile.ProfilePath("."), profile.CPUProfile).Stop()
}
state, err := loadJSON[mipsevm.State](ctx.Path(RunInputFlag.Name))
if err != nil {
......@@ -347,5 +353,6 @@ var RunCommand = &cli.Command{
RunStopAtFlag,
RunMetaFlag,
RunInfoAtFlag,
RunPProfCPU,
},
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment