From 6d103cb1f120cd29cc4abc61dc29417703bc79f3 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Fri, 2 Sep 2022 10:51:13 -0600 Subject: [PATCH] Add some logging --- cmd/serve.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/serve.go b/cmd/serve.go index eb4438f..cd53a60 100644 --- a/cmd/serve.go +++ b/cmd/serve.go @@ -20,6 +20,7 @@ import ( _ "net/http/pprof" "os" "os/signal" + "runtime" "sync" "github.com/ethereum/go-ethereum/rpc" @@ -49,8 +50,18 @@ func init() { rootCmd.AddCommand(serveCmd) } +func maxParallelism() int { + maxProcs := runtime.GOMAXPROCS(0) + numCPU := runtime.NumCPU() + if maxProcs < numCPU { + return maxProcs + } + return numCPU +} + func serve() { logWithCommand.Info("Running eth-statediff-service serve command") + logWithCommand.Infof("Parallelism: %d", maxParallelism()) statediffService, err := createStateDiffService() if err != nil { @@ -63,6 +74,7 @@ func serve() { // See: https://www.farsightsecurity.com/blog/txt-record/go-remote-profiling-20161028/ // Do not use the default http multiplexor elsewhere in this process. go func() { + logWithCommand.Info("Starting pprof listener on port 6060") logWithCommand.Fatal(http.ListenAndServe("localhost:6060", nil)) }() parallel := viper.GetBool("prerun.parallel")