Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add NoProfile #31

Open
josharian opened this issue Nov 23, 2016 · 3 comments
Open

Add NoProfile #31

josharian opened this issue Nov 23, 2016 · 3 comments

Comments

@josharian
Copy link

josharian commented Nov 23, 2016

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.

@gbbr
Copy link
Member

gbbr commented Sep 18, 2017

This sounds good to me considering that:

@gbbr
Copy link
Member

gbbr commented Sep 18, 2017

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?

@marco-m
Copy link

marco-m commented Oct 2, 2019

Hello, is this issue still valid ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants