aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorMission Liao <mission.liao@dexon.org>2018-11-01 09:07:28 +0800
committerGitHub <noreply@github.com>2018-11-01 09:07:28 +0800
commit96a8c333f47dff1db938ee93155d55413fa70799 (patch)
treeaaa845dcf54aa2b08d68badfb98ab8b808da9945 /cmd
parent6f33d1e0bbf7d976bd14d3dffd35e4e40a78a0c2 (diff)
downloadtangerine-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar
tangerine-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar.gz
tangerine-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar.bz2
tangerine-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar.lz
tangerine-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar.xz
tangerine-consensus-96a8c333f47dff1db938ee93155d55413fa70799.tar.zst
tangerine-consensus-96a8c333f47dff1db938ee93155d55413fa70799.zip
Add pprof to dexcon commands (#282)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/dexcon-simulation-with-scheduler/main.go7
-rw-r--r--cmd/dexcon-simulation/main.go9
2 files changed, 12 insertions, 4 deletions
diff --git a/cmd/dexcon-simulation-with-scheduler/main.go b/cmd/dexcon-simulation-with-scheduler/main.go
index eeee65c..5e04538 100644
--- a/cmd/dexcon-simulation-with-scheduler/main.go
+++ b/cmd/dexcon-simulation-with-scheduler/main.go
@@ -5,6 +5,8 @@ import (
"log"
"math"
"math/rand"
+ "net/http"
+ _ "net/http/pprof"
"os"
"runtime"
"runtime/pprof"
@@ -24,7 +26,10 @@ var (
func main() {
flag.Parse()
rand.Seed(time.Now().UnixNano())
-
+ // Supports runtime pprof monitoring.
+ go func() {
+ log.Println(http.ListenAndServe("localhost:6060", nil))
+ }()
if *configFile == "" {
log.Fatal("error: no configuration file specified")
}
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)