profile

package module
v0.0.0-...-a38fda4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2016 License: BSD-2-Clause Imports: 7 Imported by: 2

README

profile

THIS PROJECT HAS MOVED TO github.com/pkg/profile

Please do not use this package. Please do not report issues against this package. Please migrate to github.com/pkg/profile

Documentation

Overview

Package profile provides a simple way to manage runtime/pprof profiling of your Go application.

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	CPUProfile = &Config{
		CPUProfile: true,
	}

	MemProfile = &Config{
		MemProfile: true,
	}

	BlockProfile = &Config{
		BlockProfile: true,
	}
)

Functions

func Start

func Start(cfg *Config) interface {
	Stop()
}

Start starts a new profiling session configured using *Config. The caller should call the Stop method on the value returned to cleanly stop profiling. Passing a nil *Config is the same as passing a *Config with defaults chosen.

Example
package main

import (
	"github.com/davecheney/profile"
)

func main() {
	// start a simple CPU profile and register
	// a defer to Stop (flush) the profiling data.
	defer profile.Start(profile.CPUProfile).Stop()
}
Output:

Types

type Config

type Config struct {
	// Quiet suppresses informational messages during profiling.
	Quiet bool

	// CPUProfile controls if cpu profiling will be enabled.
	// It defaults to false.
	CPUProfile bool

	// MemProfile controls if memory profiling will be enabled.
	// It defaults to false.
	MemProfile bool

	// BlockProfile controls if block (contention) profiling will
	// be enabled.
	// It defaults to false.
	BlockProfile bool

	// ProfilePath controls the base path where various profiling
	// files are written. If blank, the base path will be generated
	// by ioutil.TempDir.
	ProfilePath string

	// NoShutdownHook controls whether the profiling package should
	// hook SIGINT to write profiles cleanly.
	// Programs with more sophisticated signal handling should set
	// this to true and ensure the Stop() function returned from Start()
	// is called during shutdown.
	NoShutdownHook bool
}

Config controls the operation of the profile package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL