diff options
-rw-r--r-- | cmd/dexcon-simulation-with-scheduler/main.go | 7 | ||||
-rw-r--r-- | cmd/dexcon-simulation/main.go | 9 |
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) |