}
func init() {
+ runNodeCmd.Flags().String("prof_laddr", config.ProfListenAddress, "Use http to profile bytomd programs")
+
// p2p flags
runNodeCmd.Flags().String("p2p.laddr", config.P2P.ListenAddress, "Node listen address. (0.0.0.0:0 means any interface, any port)")
runNodeCmd.Flags().String("p2p.seeds", config.P2P.Seeds, "Comma delimited host:port seed nodes")
sw.AddReactor("PEX", pexReactor)
}
- // add the event switch to all services
- // they should all satisfy events.Eventable
- //SetEventSwitch(eventSwitch, bcReactor, mempoolReactor, consensusReactor)
-
// run the profile server
profileHost := config.ProfListenAddress
if profileHost != "" {
- // to do: start profile host
+ // Profiling bytomd programs.see (https://blog.golang.org/profiling-go-programs)
+ // go tool pprof http://profileHose/debug/pprof/heap
+ go func() {
+ http.ListenAndServe(profileHost, nil)
+ } ()
}
node := &Node{