首页 存档 技术 查看内容

Golang Mutex profile

2018-3-30 13:00 |来自: 互联网 280 0

摘要: Go 1.8引入了mutex profile ,允许您捕获goroutine与mutex相关的堆栈跟踪。 你需要设置采样率runtime.SetMutexProfileFraction的值大于零,以便收集相关信息。 考虑下面的程序: import _ "net/http/pprof"var m ...

Go 1.8引入了mutex profile ,允许您捕获goroutine与mutex相关的堆栈跟踪。

你需要设置采样率runtime.SetMutexProfileFraction的值大于零,以便收集相关信息。

考虑下面的程序:

import _ "net/http/pprof"var mu sync.Mutexvar items = make(map[int]struct{})

runtime.SetMutexProfileFraction(5)for i := 0; i
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

相关分类

返回顶部