Documentation ¶
Overview ¶
Package profile provides a simple way to manage multiple runtime/pprof profiling of your Go application
Index ¶
Constants ¶
const ( // DefaultPath holds the default path where to create pprof file DefaultPath = "./" /* DefaultMemProfileRate holds the default memory profiling rate See also http://golang.org/pkg/runtime/#pkg-variables */ DefaultMemProfileRate = 4096 // DefaultMemProfileRate holds the default memory profiling type DefaultMemProfileType = MemProfileHeap // Supported memory profiles MemProfileHeap MemProfileType = "heap" MemProfileAllocs MemProfileType = "allocs" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { /* Path holds the base path where various profiling files are written If blank, the base path will be the current directory "./" */ Path string // UseTempPath let the path be generated by "ioutil.TempDir" UseTempPath bool // PanicIfFail holds the flag to decide whether a profile failure causes a panic PanicIfFail bool // EnableInterruptHook controls whether to start a goroutine to wait for interruption signals to stop profiling EnableInterruptHook bool // Quiet suppresses informational messages during profiling Quiet bool /* MemProfileRate holds the rate for the memory profile See DefaultMemProfileRate for default value */ MemProfileRate int /* MemProfileType holds the type for the memory profile Available values: heap | allocs See DefaultMemProfileType for default */ MemProfileType MemProfileType // CloserHook holds a custom cleanup function that run after profiling Stop CloserHook func() // Logger offers the possibility to inject a custom logger Logger Logger }
Config holds configurations to create a new Profile
type Logger ¶
type Logger interface { Debug(...interface{}) Info(...interface{}) Warn(...interface{}) Error(...interface{}) Fatal(...interface{}) Debugf(string, ...interface{}) Infof(string, ...interface{}) Warnf(string, ...interface{}) Errorf(string, ...interface{}) Fatalf(string, ...interface{}) }
Logger defines the interface an external logger have to implement, to be passed and used by multi-profile
type MemProfileType ¶
type MemProfileType string
MemProfileType defines which type of memory profiling you want to start
type Profile ¶
type Profile struct {
// contains filtered or unexported fields
}
Profile represents a profiling session
func BlockProfile ¶
BlockProfile creates a block (contention) profiling object
func GoroutineProfile ¶
GoroutineProfile creates a goroutine profiling object
func MemProfile ¶
MemProfile creates a memory profiling object
func MutexProfile ¶
MutexProfile creates a mutex profiling object
func ThreadCreationProfile ¶
ThreadCreationProfile creates a thread creation profiling object
func TraceProfile ¶
TraceProfile creates an execution tracing profiling object