diff options
| author | Chris Lu <chris.lu@gmail.com> | 2017-06-22 01:33:58 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2017-06-22 01:33:58 -0700 |
| commit | 1fbb8723dc414dc9b84bbaf84224b6f5829d34de (patch) | |
| tree | 4e07b790133975429710cdb80b9d34438e5d5fc6 /weed/command/master.go | |
| parent | 2c7dad589dcb7ed513180eb4a743e389f8134a73 (diff) | |
| download | seaweedfs-1fbb8723dc414dc9b84bbaf84224b6f5829d34de.tar.xz seaweedfs-1fbb8723dc414dc9b84bbaf84224b6f5829d34de.zip | |
add cpu and mem pprof
Diffstat (limited to 'weed/command/master.go')
| -rw-r--r-- | weed/command/master.go | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/weed/command/master.go b/weed/command/master.go index 09089a4f9..8c5efbb9f 100644 --- a/weed/command/master.go +++ b/weed/command/master.go @@ -4,7 +4,6 @@ import ( "net/http" "os" "runtime" - "runtime/pprof" "strconv" "strings" "time" @@ -48,6 +47,7 @@ var ( masterWhiteListOption = cmdMaster.Flag.String("whiteList", "", "comma separated Ip addresses having write permission. No limit if empty.") masterSecureKey = cmdMaster.Flag.String("secure.secret", "", "secret to encrypt Json Web Token(JWT)") masterCpuProfile = cmdMaster.Flag.String("cpuprofile", "", "cpu profile output file") + masterMemProfile = cmdMaster.Flag.String("memprofile", "", "memory profile output file") masterWhiteList []string ) @@ -57,17 +57,8 @@ func runMaster(cmd *Command, args []string) bool { *mMaxCpu = runtime.NumCPU() } runtime.GOMAXPROCS(*mMaxCpu) - if *masterCpuProfile != "" { - f, err := os.Create(*masterCpuProfile) - if err != nil { - glog.Fatal(err) - } - pprof.StartCPUProfile(f) - defer pprof.StopCPUProfile() - OnInterrupt(func() { - pprof.StopCPUProfile() - }) - } + util.SetupProfiling(*masterCpuProfile, *masterMemProfile) + if err := util.TestFolderWritable(*metaFolder); err != nil { glog.Fatalf("Check Meta Folder (-mdir) Writable %s : %s", *metaFolder, err) } |
