luci: go.chromium.org/luci/common/runtime/profiling Index | Files

package profiling

import "go.chromium.org/luci/common/runtime/profiling"

Index

Package Files

profiler.go

type Profiler Uses

type Profiler struct {
    // BindHTTP, if not empty, is the HTTP address to bind to.
    //
    // Can also be configured with "-profile-bind-http" flag.
    BindHTTP string

    // Dir, if set, is the path where profiling data will be written to.
    //
    // Can also be configured with "-profile-output-dir" flag.
    Dir string

    // ProfileCPU, if true, indicates that the profiler should profile the CPU.
    //
    // Requires Dir to be set, since it's where the profiler output is dumped.
    //
    // Can also be set with "-profile-cpu".
    ProfileCPU bool

    // ProfileHeap, if true, indicates that the profiler should profile heap
    // allocations.
    //
    // Requires Dir to be set, since it's where the profiler output is dumped.
    //
    // Can also be set with "-profile-heap".
    ProfileHeap bool

    // Logger, if not nil, will be used to log events and errors. If nil, no
    // logging will be used.
    Logger logging.Logger
    // Clock is the clock instance to use. If nil, the system clock will be used.
    Clock clock.Clock
    // contains filtered or unexported fields
}

Profiler helps setup and manage profiling

func (*Profiler) AddFlags Uses

func (p *Profiler) AddFlags(fs *flag.FlagSet)

AddFlags adds command line flags to common Profiler fields.

func (*Profiler) DumpSnapshot Uses

func (p *Profiler) DumpSnapshot() error

DumpSnapshot dumps a profile snapshot to the configured output directory. If no output directory is configured, nothing will happen.

func (*Profiler) Start Uses

func (p *Profiler) Start() error

Start starts the Profiler's configured operations. On success, returns a function that can be called to shutdown the profiling server.

Calling Stop is not necessary, but will enable end-of-operation profiling to be gathered.

func (*Profiler) Stop Uses

func (p *Profiler) Stop()

Stop stops the Profiler's operations.

Package profiling imports 14 packages (graph) and is imported by 4 packages. Updated 2018-10-19. Refresh now. Tools for package owners.