pkg/profile

No support to run multiple profile

prakashettigar opened this issue · 6 comments

profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook)
profile.Start(profile.CPUProfile, profile.ProfilePath("."), profile.NoShutdownHook)

Starting multiple profiles throws an error : profile: Start() already called

This is a deliberate design choice.

10sor commented

@davecheney can you please explain why?

Running multiple profiles at the same time causes interference.

@davecheney is the interference something that breaks or just skew results? For example with mem+cpu the coarse relative picture seems to hold up well in cases I've checked despite the overhead.

It skews the results.

I suggest to add the explanation to the actual error, as it's not trivial as in fact it makes the pkg do more than just a convenient proxy to the native API, because the native API does allow running multiple profilers.

If you agree I can make the PR