glog 中封装了profile.go ,profile是用来定时记录一个profile文件 默认的时间间隔是一小时 默认记录的是内存使用情况 (mem) pprof文件的默认位置在/tmp/pprof/exeName/day_hour_minute/mem.pprof 修改配置方式
项目地址:https://github.com/gw123/glog
下载方式:
go get github.com/gw123/glog
SetProfile(ProfileMode(mode)) mode支持的profile类型 PModeCpu = "cpu" PModeMem = "mem" PModeMutex = "mutex" PModeThread = "thread" PModeTrace = "trace"
SetProfile(ProfilePath("./"))
SetProfile(ProfilePeriod(time.minute*10))
SetProfile(ProfileMode("cpu"), ProfilePath("./"), ProfilePeriod(time.minute*10))
StartProfile()
StopProfile()