MCPcopy
hub / github.com/dgraph-io/dgraph / StartProfile

Function StartProfile

x/profile.go:23–44  ·  view source on GitHub ↗

StartProfile starts a new mode for profiling.

(conf *viper.Viper)

Source from the content-addressed store, hash-verified

21
22// StartProfile starts a new mode for profiling.
23func StartProfile(conf *viper.Viper) Stopper {
24 profileMode := conf.GetString("profile_mode")
25 switch profileMode {
26 case "cpu":
27 return profile.Start(profile.CPUProfile)
28 case "mem":
29 return profile.Start(profile.MemProfile)
30 case "mutex":
31 return profile.Start(profile.MutexProfile)
32 case "block":
33 blockRate := conf.GetInt("block_rate")
34 runtime.SetBlockProfileRate(blockRate)
35 return profile.Start(profile.BlockProfile)
36 case "":
37 // do nothing
38 return noOpStopper{}
39 default:
40 fmt.Printf("Invalid profile mode: %q\n", profileMode)
41 os.Exit(1)
42 return noOpStopper{}
43 }
44}
45
46type noOpStopper struct{}
47

Callers 9

initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initRestoreFunction · 0.92
initBackupLsFunction · 0.92
initExportBackupFunction · 0.92

Calls 1

StartMethod · 0.65

Tested by

no test coverage detected