expansion

Golang进阶笔记

May 19, 2021
note, golang, expansion
golang, expansion

Golang进阶笔记 # 性能分析 # import ( "net/http" _ "net/http/pprof" ) go func() { log.Println(http.ListenAndServe("localhost:6060", nil)) }() 将以上代码插入程序中 启动之后执行 go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30 具体使用方法可以help 如果使用top的话就可以查看方法占用了 (pprof) top Showing nodes accounting for 29.59s, 98.60% of 30.01s total Dropped 35 nodes (cum <= 0.15s) flat flat% sum% cum cum% 28.98s 96.57% 96.57% 28.98s 96.57% time.Now 0.24s 0.8% 97.37% 0.51s 1.70% runtime.selectgo 0.16s 0.53% 97.90% 0.16s 0.53% memeqbody 0.13s 0.43% 98.33% 0.29s 0.97% runtime. ...