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

Method After

cpu.go:231–249  ·  view source on GitHub ↗
(ctx context.Context, mod api.Module, def api.FunctionDefinition, _ []uint64)

Source from the content-addressed store, hash-verified

229}
230
231func (p cpuProfiler) After(ctx context.Context, mod api.Module, def api.FunctionDefinition, _ []uint64) {
232 i := len(p.frames) - 1
233 f := p.frames[i]
234 p.frames = p.frames[:i]
235
236 if f.start != 0 {
237 duration := p.time() - f.start
238 if i := len(p.frames); i > 0 {
239 p.frames[i-1].sub += duration
240 }
241 duration -= f.sub
242 p.mutex.Lock()
243 if p.counts != nil {
244 p.counts.observe(f.trace, duration)
245 }
246 p.mutex.Unlock()
247 p.traces = append(p.traces, f.trace)
248 }
249}
250
251func (p cpuProfiler) Abort(ctx context.Context, mod api.Module, def api.FunctionDefinition, _ error) {
252 p.After(ctx, mod, def, nil)

Callers 4

AbortMethod · 0.95
TestCPUProfilerTimeFunction · 0.45

Calls 1

observeMethod · 0.45

Tested by 3

TestCPUProfilerTimeFunction · 0.36