gpt4 book ai didi

c - 解释 gprof 结果和粒度

转载 作者:太空宇宙 更新时间:2023-11-04 04:45:57 24 4
gpt4 key购买 nike

我第一次使用 gprof 分析 C 程序。以下几行出现在我使用生成的报告中;

 $  gprof test_gprof gmon.out > analysis.txt

平面轮廓

Each sample counts as 0.01 seconds.

这是时间上的最大分辨率吗?

在调用图中:

granularity: each sample hit covers 4 byte(s) for 7.69% of 0.13 seconds

这里的 4 个字节到底是什么?它在谈论什么时间?

最佳答案

请阅读此 manual 的第 5.1 和 5.2 章.您也可以在 CentOS 上使用以下命令阅读本手册:

$ info gprof

在平面轮廓中,

Each sample counts as 0.01 seconds.

表示采样周期为100Hz,不受gprof自身控制(查看pageone了解更多详情)。因此,0.01 秒 理论上不是时间上的最大分辨率。

至于调用图,根据这个doc来自甲骨文,

The "4 bytes" means resolution to a single instruction. The "0.07% of 14.74 seconds" means that each sample, representing ten milliseconds of CPU time, accounts for 0.07% of the run.

关于c - 解释 gprof 结果和粒度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20920682/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com