Documentation
¶
Overview ¶
Package autopprof provides a development-time library to collect pprof profiles from Go programs.
This package is experimental and APIs may change.
Example ¶
package main
import (
"time"
"github.com/rakyll/autopprof"
)
func main() {
// Add the following to your main, then
// use CTRL+\ to intercept and capture.
// Pprof UI will start in 15 seconds once
// the profile is captured.
autopprof.Capture(autopprof.CPUProfile{
Duration: 30 * time.Second,
})
}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BlockProfile ¶
type BlockProfile struct {
// Rate is the fraction of goroutine blocking events that
// are reported in the blocking profile. The profiler aims to
// sample an average of one blocking event per rate nanoseconds spent blocked.
//
// If zero value is provided, it will include every blocking event
// in the profile.
Rate int
}
BlockProfile captures stack traces that led to blocking on synchronization primitives.
func (BlockProfile) Capture ¶
func (p BlockProfile) Capture() (string, error)
type CPUProfile ¶
CPUProfile captures the CPU profile.
func (CPUProfile) Capture ¶
func (p CPUProfile) Capture() (string, error)
type GoroutineProfile ¶
type GoroutineProfile struct{}
GoroutineProfile captures stack traces of all current goroutines.
func (GoroutineProfile) Capture ¶
func (p GoroutineProfile) Capture() (string, error)
type HeapProfile ¶
type HeapProfile struct{}
HeapProfile captures the heap profile.
func (HeapProfile) Capture ¶
func (p HeapProfile) Capture() (string, error)
type MutexProfile ¶
type MutexProfile struct{}
MutexProfile captures stack traces of holders of contended mutexes.
func (MutexProfile) Capture ¶
func (p MutexProfile) Capture() (string, error)
type ThreadcreateProfile ¶
type ThreadcreateProfile struct{}
Threadcreate profile captures the stack traces that led to the creation of new OS threads.
func (ThreadcreateProfile) Capture ¶
func (p ThreadcreateProfile) Capture() (string, error)
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
helloworld
command
Package main contains a simple hello world example for autopprof.
|
Package main contains a simple hello world example for autopprof. |
Click to show internal directories.
Click to hide internal directories.