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 ¶
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.
Click to show internal directories.
Click to hide internal directories.