MCPcopy Create free account
hub / github.com/dolthub/doltgresql / StartProfiling

Function StartProfiling

utils/pprof.go:39–63  ·  view source on GitHub ↗

StartProfiling starts profiling the CPU.

(options ProfilingOptions)

Source from the content-addressed store, hash-verified

37
38// StartProfiling starts profiling the CPU.
39func StartProfiling(options ProfilingOptions) {
40 profMutex.Lock()
41 defer profMutex.Unlock()
42
43 if !options.HasOptions() {
44 return
45 }
46 profOpts := []func(p *profile.Profile){profile.NoShutdownHook}
47 if options.CPU {
48 profOpts = append(profOpts, profile.CPUProfile)
49 }
50 if options.Memory {
51 profOpts = append(profOpts, profile.MemProfile)
52 }
53 if options.Block {
54 profOpts = append(profOpts, profile.BlockProfile)
55 }
56 if options.Trace {
57 profOpts = append(profOpts, profile.TraceProfile)
58 }
59 if len(options.Path) > 0 {
60 profOpts = append(profOpts, profile.ProfilePath(options.Path))
61 }
62 prof = profile.Start(profOpts...)
63}
64
65// StopProfiling stops profiling the CPU.
66func StopProfiling() {

Callers 1

mainFunction · 0.92

Calls 4

LockMethod · 0.80
UnlockMethod · 0.80
HasOptionsMethod · 0.80
StartMethod · 0.80

Tested by

no test coverage detected