climate
climate copied to clipboard
Support global --profile?
Might be neat.
Or maybe --cpuprofile and --memprofile (see https://pkg.go.dev/runtime/pprof).
A snippet I used elsewhere, for posterity --
assert.Nil(trace.Start(assert.Ok(os.Create("trace.out"))))
assert.Nil(pprof.StartCPUProfile(assert.Ok(os.Create("cpu.prof"))))
defer func() {
trace.Stop()
pprof.StopCPUProfile()
runtime.GC()
assert.Nil(pprof.Lookup("allocs").WriteTo(assert.Ok(os.Create("mem.prof")), 0))
}()