NewProfile takes a snapshot of the current memory allocation state and builds a profile representing the state of the program memory.
(sampleRate float64)
| 69 | // NewProfile takes a snapshot of the current memory allocation state and builds |
| 70 | // a profile representing the state of the program memory. |
| 71 | func (p *MemoryProfiler) NewProfile(sampleRate float64) *profile.Profile { |
| 72 | ratio := 1 / sampleRate |
| 73 | return buildProfile(p.p, p.snapshot(), p.start, time.Since(p.start), p.SampleType(), |
| 74 | []float64{ratio, ratio, ratio, ratio}, |
| 75 | ) |
| 76 | } |
| 77 | |
| 78 | // Name returns "allocs" to match the name of the memory profiler in pprof. |
| 79 | func (p *MemoryProfiler) Name() string { |
no test coverage detected