|
|
|
@ -26,8 +26,8 @@ import (
|
|
|
|
|
|
|
|
|
|
// profiling configuration variables
|
|
|
|
|
var (
|
|
|
|
|
profileName string = "none" // Name of the profile to capture.
|
|
|
|
|
profileOutput string = "profile.pprof" // File to write the profile data.
|
|
|
|
|
profileName string = "none" // Name of the profile to capture.
|
|
|
|
|
profileOutput string = "profile.pprof" // File to write the profile data.
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// addProfilingFlags registers profiling related flags to the given FlagSet.
|
|
|
|
@ -55,10 +55,10 @@ func initProfiling() error {
|
|
|
|
|
}
|
|
|
|
|
return pprof.StartCPUProfile(f)
|
|
|
|
|
case "block":
|
|
|
|
|
runtime.SetBlockProfileRate(1) // Sampling every block event
|
|
|
|
|
runtime.SetBlockProfileRate(1) // Sampling every block event
|
|
|
|
|
return nil
|
|
|
|
|
case "mutex":
|
|
|
|
|
runtime.SetMutexProfileFraction(1) // Sampling every mutex event
|
|
|
|
|
runtime.SetMutexProfileFraction(1) // Sampling every mutex event
|
|
|
|
|
return nil
|
|
|
|
|
default:
|
|
|
|
|
if profile := pprof.Lookup(profileName); profile == nil {
|
|
|
|
|