Documentation
¶
Index ¶
- func CPUProfile(w http.ResponseWriter, r *http.Request)
- func CPUProfileDo(typ CPUProfileType, do func() error) error
- func CPUProfileHandler(w http.ResponseWriter, r *http.Request)
- func GetPerfSVGHtml(w io.Writer, name string, interval int64) error
- func HeapProfile(w http.ResponseWriter, r *http.Request)
- func StartUIPprofListener(port int)
- type CPUProfileOptions
- type CPUProfileType
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CPUProfile ¶
func CPUProfile(w http.ResponseWriter, r *http.Request)
func CPUProfileDo ¶
func CPUProfileDo(typ CPUProfileType, do func() error) error
CPUProfileDo invokes the closure while enabling (and disabling) the supplied CPUProfileMode. Errors if the profiling mode could not be set or if do() returns an error.
func CPUProfileHandler ¶
func CPUProfileHandler(w http.ResponseWriter, r *http.Request)
CPUProfileHandler is replacement for `pprof.Profile` that supports additional options.
func HeapProfile ¶
func HeapProfile(w http.ResponseWriter, r *http.Request)
func StartUIPprofListener ¶
func StartUIPprofListener(port int)
Types ¶
type CPUProfileOptions ¶
type CPUProfileOptions struct {
// Number of seconds to profile for.
Seconds int32
// Whether to enable pprof labels while the profile is taken.
WithLabels bool
}
CPUProfileOptions contains options for generating a CPU profile.
func CPUProfileOptionsFromRequest ¶
func CPUProfileOptionsFromRequest(r *http.Request) CPUProfileOptions
CPUProfileOptionsFromRequest parses the `seconds` and `labels` fragments from the URL and populates CPUProfileOptions from it.
For convenience, `labels` defaults to true, that is, `?labels=false` must be specified to disable them. `seconds` defaults to the pprof default of 30s.
func (CPUProfileOptions) Type ¶
func (opts CPUProfileOptions) Type() CPUProfileType
Type returns the CPUProfileType corresponding to the options.
type CPUProfileType ¶
type CPUProfileType int32
CPUProfileType tracks whether a CPU profile is in progress.
const ( // CPUProfileNone means that no CPU profile is currently taken. CPUProfileNone CPUProfileType = iota // CPUProfileDefault means that a CPU profile is currently taken, but // pprof labels are not enabled. CPUProfileDefault // CPUProfileWithLabels means that a CPU profile is currently taken and // pprof labels are enabled. CPUProfileWithLabels )
var GlobalCPUProfiling CPUProfileType