MCPcopy Create free account
hub / github.com/dispatchrun/wzprof / NewHandler

Method NewHandler

mem.go:168–172  ·  view source on GitHub ↗

NewHandler returns a http handler allowing the profiler to be exposed on a pprof-compatible http endpoint. The sample rate is a value between 0 and 1 used to scale the profile results based on the sampling rate applied to the profiler so the resulting values remain representative. The symbolizer p

(sampleRate float64)

Source from the content-addressed store, hash-verified

166// The symbolizer passed as argument is used to resolve names of program
167// locations recorded in the profile.
168func (p *MemoryProfiler) NewHandler(sampleRate float64) http.Handler {
169 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
170 serveProfile(w, p.NewProfile(sampleRate))
171 })
172}
173
174// NewFunctionListener returns a function listener suited to install a hook on
175// functions responsible for memory allocation.

Callers

nothing calls this directly

Calls 2

NewProfileMethod · 0.95
serveProfileFunction · 0.85

Tested by

no test coverage detected