CPU profiling (#1371)

* Add cpuprofile flag
* Add notes to readme
This commit is contained in:
WithoutPants
2021-05-16 17:21:11 +10:00
committed by GitHub
parent bc9aa02835
commit 16fe21138f
5 changed files with 59 additions and 5 deletions

View File

@@ -142,7 +142,8 @@ func (e MissingConfigError) Error() string {
}
type Instance struct {
isNewSystem bool
cpuProfilePath string
isNewSystem bool
}
var instance *Instance
@@ -162,6 +163,13 @@ func (i *Instance) SetConfigFile(fn string) {
viper.SetConfigFile(fn)
}
// GetCPUProfilePath returns the path to the CPU profile file to output
// profiling info to. This is set only via a commandline flag. Returns an
// empty string if not set.
func (i *Instance) GetCPUProfilePath() string {
return i.cpuProfilePath
}
func (i *Instance) Set(key string, value interface{}) {
viper.Set(key, value)
}