Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用pprof的golang配置文件,如何获得命中计数而不是持续时间?_Go_Profile_Pprof - Fatal编程技术网

使用pprof的golang配置文件,如何获得命中计数而不是持续时间?

使用pprof的golang配置文件,如何获得命中计数而不是持续时间?,go,profile,pprof,Go,Profile,Pprof,如何获得命中率,如: (pprof) top Total: 2525 samples 298 11.8% 11.8% 345 13.7% runtime.mapaccess1_fast64 268 10.6% 22.4% 2124 84.1% main.FindLoops 不是,持续时间如下: (pprof) top 2220ms of 3080ms total (72.08%) Dropped 72 nodes (cum <= 15.4

如何获得命中率,如:

(pprof) top
Total: 2525 samples
     298  11.8%  11.8%      345  13.7% runtime.mapaccess1_fast64
     268  10.6%  22.4%     2124  84.1% main.FindLoops
不是,持续时间如下:

(pprof) top
2220ms of 3080ms total (72.08%)
Dropped 72 nodes (cum <= 15.40ms)
Showing top 10 nodes out of 111 (cum >= 60ms)
      flat  flat%   sum%        cum   cum%
    1340ms 43.51% 43.51%     1410ms 45.78%  runtime.cgocall_errno

您可以使用
go工具pprof-callgrind-output callgrind.out innercpu.pprof
从收集的评测数据中生成callgrind数据。然后你可以用它来想象。它将显示通话次数

defer pprof.StopCPUProfile()
f, err := os.Create("innercpu.pprof")
if err != nil {
    fmt.Println("Error: ", err)
}
pprof.StartCPUProfile(f)