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 ...
随机推荐
- 从汇编看c++中的placement operator new
placement operator new是重载的operator new运算符,它允许我们将对象放到一个指定的内存中.下面来看c++源码: class X { private: int _x; p ...
- TRIGGERS_监测系统_原始数据表触发器—调用告警信息存储过程
//每次向originaldata表中插入数据就会触发该触发器 create or replace trigger originaldata_to_alarm after insert on ori ...
- Meteor Shower(POJ 3669)
Meteor Shower Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12816 Accepted: 3451 De ...
- 凸包(hd1392)
Surround the Trees Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Other ...
- C语言--关键字 typedef
一.typedef 1.基本使用 1> typedef 在基本数据类型中的使用 typedef int MyInt; // 相当于给 int 起了一个别名 typedef MyInt MyInt ...
- 纯js实现积木(div)拖动效果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- abiword Namespace List
abiword Namespace List Here is a list of all namespaces with brief descriptions: abicollab 这个命名空间以及 ...
- ExtJs Model之convert的使用
convert: function(value,record){} value:为当前属性的值,record.get('属性')用来获取其他属性的值. 以下案例是:将年龄减去2. Ext.define ...
- HtmlAgilityPack - 简介
HtmlAgilityPack是.net下的一个HTML解析类库.支持用XPath来解析HTML.这个意义不小,为什么呢?因为对于页面上的元素的xpath某些强大的浏览器能够直接获取得到,并不需要手动 ...
- Fiddler 教程(转)
阅读目录 Fiddler的基本介绍 Fiddler的工作原理 同类的其它工具 Fiddler如何捕获Firefox的会话 Fiddler如何捕获HTTPS会话 Fiddler的基本界面 Fiddler ...