Add some logging
This commit is contained in:
parent
99f84b6fe6
commit
6d103cb1f1
12
cmd/serve.go
12
cmd/serve.go
@ -20,6 +20,7 @@ import (
|
|||||||
_ "net/http/pprof"
|
_ "net/http/pprof"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"runtime"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
@ -49,8 +50,18 @@ func init() {
|
|||||||
rootCmd.AddCommand(serveCmd)
|
rootCmd.AddCommand(serveCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func maxParallelism() int {
|
||||||
|
maxProcs := runtime.GOMAXPROCS(0)
|
||||||
|
numCPU := runtime.NumCPU()
|
||||||
|
if maxProcs < numCPU {
|
||||||
|
return maxProcs
|
||||||
|
}
|
||||||
|
return numCPU
|
||||||
|
}
|
||||||
|
|
||||||
func serve() {
|
func serve() {
|
||||||
logWithCommand.Info("Running eth-statediff-service serve command")
|
logWithCommand.Info("Running eth-statediff-service serve command")
|
||||||
|
logWithCommand.Infof("Parallelism: %d", maxParallelism())
|
||||||
|
|
||||||
statediffService, err := createStateDiffService()
|
statediffService, err := createStateDiffService()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -63,6 +74,7 @@ func serve() {
|
|||||||
// See: https://www.farsightsecurity.com/blog/txt-record/go-remote-profiling-20161028/
|
// See: https://www.farsightsecurity.com/blog/txt-record/go-remote-profiling-20161028/
|
||||||
// Do not use the default http multiplexor elsewhere in this process.
|
// Do not use the default http multiplexor elsewhere in this process.
|
||||||
go func() {
|
go func() {
|
||||||
|
logWithCommand.Info("Starting pprof listener on port 6060")
|
||||||
logWithCommand.Fatal(http.ListenAndServe("localhost:6060", nil))
|
logWithCommand.Fatal(http.ListenAndServe("localhost:6060", nil))
|
||||||
}()
|
}()
|
||||||
parallel := viper.GetBool("prerun.parallel")
|
parallel := viper.GetBool("prerun.parallel")
|
||||||
|
Loading…
Reference in New Issue
Block a user