知识卡片
采样时间不等于墙钟等待
CPU剖析观察实际执行中的CPU活动,程序墙钟时长还包含睡眠、I/O和等待。原例Duration约19秒而样本约4秒,不能把样本百分比直接说成整个运行总时间的占比。给函数Sleep虽然延长墙钟时间,却不会按比例增加它的CPU样本;代表性CPU工作才决定可见样本。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 11.5.2 代码分析示例 · 查看原书依据
at 4:53pm (EET) Duration: 19.12s, Total samples = 4.18s (21.86%) Entering interactive mode (type "help" for commands, "o" for options) (pprof)
参考来源
- 位置:《精通 Go(Mastering Go 中文版)》11.5.2 代码分析示例,spine212(book-sources;extracted/精通 Go(Mastering Go 中文版)/_epub-src/11.5.2.html)。
- 结论依据:原例Duration、Total samples及人为Sleep直接对照,区分两种时间。
- 原始内容: at 4:53pm (EET) Duration: 19.12s, Total samples = 4.18s (21.86%) Entering interactive mode (type "help" for commands, "o" for options) (pprof)