diff options
author | Mission Liao <mission.liao@dexon.org> | 2018-11-01 09:07:28 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-01 09:07:28 +0800 |
commit | 96a8c333f47dff1db938ee93155d55413fa70799 (patch) | |
tree | aaa845dcf54aa2b08d68badfb98ab8b808da9945 /cmd/dexcon-simulation | |
parent | 6f33d1e0bbf7d976bd14d3dffd35e4e40a78a0c2 (diff) | |
download | dexon-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar dexon-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar.gz dexon-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar.bz2 dexon-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar.lz dexon-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar.xz dexon-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar.zst dexon-consensus-96a8c333f47dff1db938ee93155d55413fa70799.zip |
Add pprof to dexcon commands (#282)
Diffstat (limited to 'cmd/dexcon-simulation')
-rw-r--r-- | cmd/dexcon-simulation/main.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd/dexcon-simulation/main.go b/cmd/dexcon-simulation/main.go index 901d004..87ca452 100644 --- a/cmd/dexcon-simulation/main.go +++ b/cmd/dexcon-simulation/main.go @@ -23,6 +23,8 @@ import ( "io" "log" "math/rand" + "net/http" + _ "net/http/pprof" "os" "runtime" "runtime/pprof" @@ -40,14 +42,15 @@ var logfile = flag.String("log", "", "write log to `file`") func main() { flag.Parse() - rand.Seed(time.Now().UnixNano()) - + // Supports runtime pprof monitoring. + go func() { + log.Println(http.ListenAndServe("localhost:6060", nil)) + }() if *configFile == "" { fmt.Fprintln(os.Stderr, "error: no configuration file specified") os.Exit(1) } - if *initialize { if err := config.GenerateDefault(*configFile); err != nil { fmt.Fprintf(os.Stderr, "error: %s", err) |