import _ "net/http/pprof"

func main() {
	go func() {
	     http.ListenAndServe("localhost:6060", nil)
        }()
        /** your logic code */
}

 

you can check the web status by this url :  http://localhost:6060/debug/pprof/

 

 

#Then use the pprof tool to look at the heap profile:

go tool pprof http://localhost:6060/debug/pprof/heap
Or to look at a 30-second CPU profile:

go tool pprof http://localhost:6060/debug/pprof/profile
Or to look at the goroutine blocking profile:

go tool pprof http://localhost:6060/debug/pprof/block

  

 

 pprof info: https://github.com/g0hacker/go_command_tutorial/blob/master/0.12.md

 

相关文章:

  • 2021-06-29
  • 2021-06-17
  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-07
猜你喜欢
  • 2021-10-18
  • 2021-06-23
相关资源
相似解决方案