From 7f69acd1f21b4e42afff155b633419eda17af331 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Wed, 9 Sep 2020 11:33:52 -0700 Subject: [PATCH] sync pprof --- weed/command/filer_sync.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/weed/command/filer_sync.go b/weed/command/filer_sync.go index a48fc0369..a1d0bd2ac 100644 --- a/weed/command/filer_sync.go +++ b/weed/command/filer_sync.go @@ -12,6 +12,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/replication/source" "github.com/chrislusf/seaweedfs/weed/security" "github.com/chrislusf/seaweedfs/weed/util" + "github.com/chrislusf/seaweedfs/weed/util/grace" "google.golang.org/grpc" "io" "strings" @@ -36,6 +37,8 @@ type SyncOptions struct { var ( syncOptions SyncOptions + syncCpuProfile *string + syncMemProfile *string ) func init() { @@ -53,6 +56,8 @@ func init() { syncOptions.bTtlSec = cmdFilerSynchronize.Flag.Int("b.ttlSec", 0, "ttl in seconds on filer B") syncOptions.aDebug = cmdFilerSynchronize.Flag.Bool("a.debug", false, "debug mode to print out filer A received files") syncOptions.bDebug = cmdFilerSynchronize.Flag.Bool("b.debug", false, "debug mode to print out filer B received files") + syncCpuProfile = cmdFilerSynchronize.Flag.String("cpuprofile", "", "cpu profile output file") + syncMemProfile = cmdFilerSynchronize.Flag.String("memprofile", "", "memory profile output file") } var cmdFilerSynchronize = &Command{ @@ -76,6 +81,8 @@ func runFilerSynchronize(cmd *Command, args []string) bool { grpcDialOption := security.LoadClientTLS(util.GetViper(), "grpc.client") + grace.SetupProfiling(*syncCpuProfile, *syncMemProfile) + go func() { for { err := doSubscribeFilerMetaChanges(grpcDialOption, *syncOptions.filerA, *syncOptions.aPath, *syncOptions.filerB,