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 ...
随机推荐
- Spark集群搭建简要
Spark集群搭建 1 Spark编译 1.1 下载源代码 git clone git://github.com/apache/spark.git -b branch-1.6 1.2 修改pom文件 ...
- uva 1597 Searching the Web
The word "search engine" may not be strange to you. Generally speaking, a search engine se ...
- Sigmoid function in NN
X = [ones(m, ) X]; temp = X * Theta1'; t = size(temp, ); temp = [ones(t, ) temp]; h = temp * Theta2' ...
- iOS延时执行的四种方法
@import url(http://i.cnblogs.com/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/c ...
- C++中利用libxl操作Excel表格
libxl是一款操作excel的商业库,支持C.C++.C#和Delphi.下文利用libxl在C++中实现了从excel文档的表1中随机挑选记录,保存到新建的表中.以下为代码: #include & ...
- Git学习05 --分支管理02
1.冲突 产生冲突后,查看readme.txt 可以看到冲突内容 <<<<<<< ======= >>>>>>> ...
- Application.HookMainWindow完全替代了原来的窗口过程(但是好像也会继续传递)
unit HookMain; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialo ...
- UVA 10129-Play on Words(欧拉通路)
题意:给N个单词,判断是否单词首尾(前一个单词的尾字符与后一个单词的头字符相同)相连能否形成一条链. 解析:找欧拉通路(欧拉回路或是欧拉链路),但这题事先需要并查集一下,判断是否只属于一个集合,如aa ...
- Chart.js | HTML5 Charts for your website.
Chart.js | HTML5 Charts for your website. Chart.js
- javax.mail用smtp服务器发送带附件的邮件
jar包: javax.mail-1.5.5.jar maven配置: <dependency> <groupId>com.sun.mail</groupId> & ...