【发布时间】:2017-02-23 03:53:06
【问题描述】:
当我使用 Linux 的 time 实用程序测量 Go 程序的运行时间时,我得到以下输出:
real 1m9.177s
user 7m1.788s
sys 0m39.016s
当我在 Go 的 pprof CPU 分析器中查看相同程序执行的输出时,我得到以下输出:
Entering interactive mode (type "help" for commands)
(pprof) top
143.32s of 176s total (81.43%)
pprof 从哪里得到这个 176 的数字?它既不是时钟时间也不是 CPU 时间。我正在运行这个程序,GOMAXPROCS 设置为 8,我觉得这与它有关。 pprof 究竟是如何测量运行时间的,为什么它与 linux 的 time 不同?
【问题讨论】:
标签: go runtime profiling gperftools