提交 097c8a11 作者: Brian Tiger Chow

feat(main): change pprof flag to IPFS_PROF

@jbenet @whyrusleeping thoughts?
上级 4af79b71
...@@ -35,9 +35,10 @@ var log = eventlog.Logger("cmd/ipfs") ...@@ -35,9 +35,10 @@ var log = eventlog.Logger("cmd/ipfs")
var errHelpRequested = errors.New("Help Requested") var errHelpRequested = errors.New("Help Requested")
const ( const (
cpuProfile = "ipfs.cpuprof" EnvEnableProfiling = "IPFS_PROF"
heapProfile = "ipfs.memprof" cpuProfile = "ipfs.cpuprof"
errorFormat = "ERROR: %v\n\n" heapProfile = "ipfs.memprof"
errorFormat = "ERROR: %v\n\n"
) )
type cmdInvocation struct { type cmdInvocation struct {
...@@ -512,9 +513,7 @@ func allInterruptSignals() chan os.Signal { ...@@ -512,9 +513,7 @@ func allInterruptSignals() chan os.Signal {
func profileIfEnabled() (func(), error) { func profileIfEnabled() (func(), error) {
// FIXME this is a temporary hack so profiling of asynchronous operations // FIXME this is a temporary hack so profiling of asynchronous operations
// works as intended. // works as intended.
if u.GetenvBool("DEBUG") || os.Getenv("IPFS_LOGGING") == "debug" { if os.Getenv(EnvEnableProfiling) != "" {
u.Debug = true
u.SetDebugLogging()
stopProfilingFunc, err := startProfiling() // TODO maybe change this to its own option... profiling makes it slower. stopProfilingFunc, err := startProfiling() // TODO maybe change this to its own option... profiling makes it slower.
if err != nil { if err != nil {
return nil, err return nil, err
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论