Skip to content

Add NoProfile #31

Open
Open

Description

@josharian

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.

Activity

  1. gbbr commented on Sep 18, 2017

    @gbbr
    Member

    This sounds good to me considering that:

  2. gbbr commented on Sep 18, 2017

    @gbbr
    Member

    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?

  3. marco-m commented on Oct 2, 2019

    @marco-m

    Hello, is this issue still valid ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions