关于go语言获取cpu执行情况数据分析疑问?

wcpsoft · · 3218 次点击
代码如下: ```go var cpuProfile *os.File /*保存CPU执行信息*/ func SaveStartCpuProfile() { f, err := os.Create(fmt.Sprintf("heap_cpu_%s.prof", time.Now().Format("2015_02_26_03_04_05"))) if err != nil { log.Fatal(err) } pprof.StartCPUProfile(f) cpuProfile = f } /*保存CPU执行信息*/ func SaveEndCpuProfile() { if cpuProfile != nil { pprof.StopCPUProfile() cpuProfile.Close() } } ```
#4