gpt4 book ai didi

c++ - 如何在多核机器上解释 boost::timer::cpu_timer 的输出?

转载 作者:行者123 更新时间:2023-11-30 04:00:19 26 4
gpt4 key购买 nike

我使用 boost::timer::cpu_timer 来衡量我的应用程序中某些算法的性能。示例输出如下所示:

Algo1 duration: 6.755457s wall, 12.963683s user + 1.294808s system = 14.258491s CPU (211.1%)

来自 boost cpu_timer 文档:

The output of this program will look something like this:

5.713010s wall, 5.709637s user + 0.000000s system = 5.709637s CPU (99.9%)

In other words, this program ran in 5.713010 seconds as would be measured by a clock on the wall, the operating system charged it for 5.709637 seconds of user CPU time and 0 seconds of system CPU time, the total of these two was 5.709637, and that represented 99.9 percent of the wall clock time.

我获得的值 (211.1%) 是什么意思,是否意味着我的算法执行涉及两个以上的核心?

用户 CPU 时间系统 CPU 时间 是什么意思?

最佳答案

What does the value I obtained mean (211.1%), does it mean that more than two cores were involved in execution of my algorithm ?

这意味着该程序使用的 CPU 时间是 wall time 的两倍多一点。为此,它必须在至少三个内核上运行一段时间。

What is the meaning of user CPU time and system CPU time ?

用户CPU时间是CPU运行用户代码的时间。系统CPU时间是CPU运行系统代码的时间。当您调用系统函数时,例如从文件读取的函数,您会从运行用户代码切换到运行系统代码,直到该函数返回。

关于c++ - 如何在多核机器上解释 boost::timer::cpu_timer 的输出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26398106/

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