go筆記-pprof使用

pprof如何進行採樣:https://studygolang.com/articles/11873golang

 

go tool pprof http://localhost:6060/debug/pprof/profile spa

go tool pprof http://localhost:6060/debug/pprof/heap線程

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

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

 

  • cpu(CPU Profiling): $HOST/debug/pprof/profile,默認進行 30s 的 CPU Profiling,獲得一個分析用的 profile 文件
  • block(Block Profiling):$HOST/debug/pprof/block,查看致使阻塞同步的堆棧跟蹤
  • goroutine:$HOST/debug/pprof/goroutine,查看當前全部運行的 goroutines 堆棧跟蹤
  • heap(Memory Profiling): $HOST/debug/pprof/heap,查看活動對象的內存分配狀況
  • mutex(Mutex Profiling):$HOST/debug/pprof/mutex,查看致使互斥鎖的競爭持有者的堆棧跟蹤
  • threadcreate:$HOST/debug/pprof/threadcreate,查看建立新OS線程的堆棧跟蹤
相關文章
相關標籤/搜索