climate icon indicating copy to clipboard operation
climate copied to clipboard

Support global --profile?

Open avamsi opened this issue 1 year ago • 2 comments

Might be neat.

avamsi avatar Feb 23 '24 07:02 avamsi

Or maybe --cpuprofile and --memprofile (see https://pkg.go.dev/runtime/pprof).

avamsi avatar Feb 23 '24 12:02 avamsi

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))
}()

avamsi avatar Feb 28 '24 13:02 avamsi