一、导入包

import _ "net/http/pprof"

二、启动监控routine

go func() {
http.ListenAndServe("0.0.0.0:18080", nil)
}() 三、访问web服务
例:分析CPU占用情况
go tool pprof http://localhost:18080/debug/pprof/profile
(pprof) top10
Total: 2525 samples
298 11.8% 11.8% 345 13.7% runtime.mapaccess1_fast64
268 10.6% 22.4% 2124 84.1% main.FindLoops
251 9.9% 32.4% 451 17.9% scanblock
178 7.0% 39.4% 351 13.9% hash_insert
131 5.2% 44.6% 158 6.3% sweepspan
119 4.7% 49.3% 350 13.9% main.DFS
96 3.8% 53.1% 98 3.9% flushptrbuf
95 3.8% 56.9% 95 3.8% runtime.aeshash64
95 3.8% 60.6% 101 4.0% runtime.settype_flush
88 3.5% 64.1% 988 39.1% runtime.mallocgc 四、参考
// pprof 命令
https://blog.golang.org/profiling-go-programs
// web 上几项监控指标
https://golang.org/pkg/net/http/pprof/

最新文章

  1. 纯css实现模块阴影变色效果
  2. Mysql通信协议
  3. jQuery选择器和选取方法
  4. Android5.0常用颜色属性说明
  5. C++ Win32控制台应用程序捕捉关闭事件
  6. MongoDB安装,打开及增,删,改,查
  7. 自动备份多个MOSS站点集的脚本
  8. Mahout-Pearson correlation的实现
  9. ARMv8 Linux内核异常处理过程分析
  10. 记得有一个奇怪的ORA-04028: cannot generate diana for object
  11. git安装包解压后没有configure
  12. 3、调试AngularJs
  13. 字符串格式化:f-strings
  14. Swift5 语言指南(二) 版本兼容性
  15. 黄聪:多个wordpress网站(不同域名)共享用户数据的方法
  16. 线程系列07,使用lock语句块或Interlocked类型方法保证自增变量的数据同步
  17. 如何利用webmin在Linux主机中添加网站
  18. flask请求和应用上下文
  19. 【python】argparse学习(转)
  20. Arduino I2C + 温湿度传感器HTS221

热门文章

  1. [LeetCode] 191. Number of 1 Bits ☆(位 1 的个数)
  2. Nginx隐藏版本号操作
  3. JSP开发Web应用系统
  4. Android--Android Studio 打开ADM报错
  5. learning ddr reset initialization with stable power
  6. bzoj1239
  7. redis客户端windows版中文乱码解决方案
  8. OO Summary Ⅱ
  9. substr、substring和slice的区别
  10. python中的argparse模块(参数解析)