Open josharian opened 7 years ago
This sounds good to me considering that:
Some thoughts I have on this are:
Calling it NoProfile
would create some stutter in the external context, where you would use it as profile.NoProfile
. Personally I would prefer something like profile.Off
if this is something that we really need.
Would you be able to provide a more thorough example of how you would use this? As far as I can see it, the current implementation already allows you to conditionally run profiles via flags or other means. I think adding this additional code might unnecessarily complicate an otherwise simple package, unless I'm missing the point. You can simply do something like:
var p interface {
Stop()
}
if condition {
p = profile.Start(/* your options */)
}
// ...
if p != nil { p.Stop() }
Am I misunderstanding something or is this the same use case?
Hello, is this issue still valid ?
For programs that have both non-trivial shutdown hook plumbing and flags controlling profiling, it'd be convenient to have a NoProfile option with a no-op Stop function. I'll send a PR if you're amenable.