go pprof
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
go pprof的更多相关文章
- Golang pprof heap profile is empty
Q: When you use `go tool pprof` get heap data, profile is empty. A: The default sampling rate is 1 s ...
- 使用go tool pprof分析内存泄漏、CPU消耗
go中提供了pprof包来做代码的性能监控,在两个地方有包: net/http/pprof runtime/pprof 其实net/http/pprof中只是使用runtime/pprof包来进行封装 ...
- golang使用pprof检查goroutine泄露
有一段时间,我们的推送服务socket占用非常不正常,我们自己统计的同一时候在线就10w的用户,可是占用的socket居然达到30w,然后查看goroutine的数量,发现已经60w+. 每一个用户占 ...
- Go的pprof使用
go中有pprof包来做代码的性能监控,在两个地方有包: net/http/pprof runtime/pprof 其实net/http/pprof中只是使用runtime/pprof包来进行封装了一 ...
- Golang使用pprof和qcachegrind进行性能监控
Golang为我们提供了非常方便的性能测试工具pprof,使用pprof可以非常方便地对Go程序的运行效率进行监测.本文讲述如何使用pprof对Go程序进行性能测试,并使用qcachegrind查看性 ...
- Go 程序的性能优化及 pprof 的使用
Go 程序的性能优化及 pprof 的使用 程序的性能优化无非就是对程序占用资源的优化.对于服务器而言,最重要的两项资源莫过于 CPU 和内存.性能优化,就是在对于不影响程序数据处理能力的情况下,我们 ...
- 使用 pprof 和 Flame-Graph 调试 Golang 应用
前言 最近用 Golang 实现了一个日志搜集上报程序(内部称 logger 项目),线上灰度测试过程发现 logger 占用 CPU 非常高(80% - 100%).而此项目之前就在线上使用,用于消 ...
- golang 使用pprof进行性能调优
package main import "fmt" func lengthOfNonRepeatingSubStr(s string) int { lastOccurred := ...
- go笔记-pprof使用
go tool pprof http://localhost:6060/debug/pprof/profile go tool pprof http://localhost:6060/debug/pp ...
随机推荐
- Android 开发技术流程
1.网络连接通信 HttpClient 类通信(见<第一行代码> 郭霖2014.8月第一版P385) Android Asynchronous Http Client (见 http: ...
- 三星ssd转移系统
1. (正常模式)如果源磁盘小于目标磁盘 第 1 步 . 开始迁移 第 2 步 . 连接目标磁盘 ① 目标磁盘连接后,其状态会显示在屏幕上. ※ 如果您要连接 mSATA 产品,那么还需要 ...
- EditText判断用户输入完成,然后进行操作解决方案
private Timer timer = new Timer(); private final long DELAY = 1000; // in ms EditText editTextStop = ...
- Yii 安装
// 安装 composer curl -s http://getcomposer.org/installer | php // 把 composer 添加到全局命令 mv composer.phar ...
- 做一个正气的杭电人--hdu2500
做一个正气的杭电人 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- 子shell的$$
http://blog.csdn.net/firefoxbug/article/details/7426109
- mosquitto在Linux环境下的部署/安装/使用/测试
mosquitto在Linux环境下的部署 看了有三四天的的源码,(当然没怎么好好看了),突然发现对mosquitto的源码有了一点点感觉,于是在第五天决定在Linux环境下部署mosquitto. ...
- JavaEE Tutorials (28) - Duke书店案例研究示例
28.1Duke书店的设计和架构43828.2Duke书店接口439 28.2.1Book Java持久化API实体439 28.2.2Duke书店中使用的企业bean440 28.2.3Duke书店 ...
- 【转】如何设置无线路由器的信道以获得最佳WIFI体验?
原文网址:http://jingyan.baidu.com/album/f25ef2546e28e4482c1b8225.html 现在随着移动互联网的发展,移动终端的普及,WIFI越来越必不可少,所 ...
- devStack
1,devstack shell 脚本开源官网 http://devstack.org/ 脚本功能快速搭建 OpenStack 的运行和开发环境 [Note tips by Ruiy devstack ...