MCPcopy Create free account
hub / github.com/pkg/profile / ExampleStart_withFlags

Function ExampleStart_withFlags

example_test.go:52–68  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50}
51
52func ExampleStart_withFlags() {
53 // use the flags package to selectively enable profiling.
54 mode := flag.String("profile.mode", "", "enable profiling mode, one of [cpu, mem, mutex, block]")
55 flag.Parse()
56 switch *mode {
57 case "cpu":
58 defer profile.Start(profile.CPUProfile).Stop()
59 case "mem":
60 defer profile.Start(profile.MemProfile).Stop()
61 case "mutex":
62 defer profile.Start(profile.MutexProfile).Stop()
63 case "block":
64 defer profile.Start(profile.BlockProfile).Stop()
65 default:
66 // do nothing
67 }
68}

Callers

nothing calls this directly

Calls 2

StartFunction · 0.92
StopMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…