Documentation ¶
Overview ¶
Package profile implements a uniform interface for getting profiling information from the Go runtime.
Index ¶
Constants ¶
const ( ProfileGoroutine = "goroutine" ProfileThreadCreate = "threadcreate" ProfileHeap = "heap" ProfileAllocs = "allocs" ProfileBlock = "block" ProfileMutex = "mutex" )
The Go runtime's built-in named profiles; to be passed to .Profile().
Variables ¶
This section is empty.
Functions ¶
Types ¶
type StopFunc ¶
type StopFunc = func() error
func AddProfileFlags ¶
AddProfileFlags adds flags to a pflag.FlagSet to write any (or all) of the standard profiles to a file, and returns a "stop" function to be called at program shutdown.
func CPU ¶
CPU arranges to write a CPU profile to the given Writer, and returns a function to be called on shutdown.
func Profile ¶
Profile arranges to write the given named-profile to the given Writer, and returns a function to be called on shutdown.
CPU profiles are not named profiles; there is a separate .CPU() function for writing CPU profiles.
The Go runtime has several built-in named profiles, and it is possible for programs to create their own named profiles with runtime/pprof.NewProfile().
This package provides ProfileXXX constants for the built-in named profiles, and a .Profiles() function that return the list of all profile names.