简体   繁体   English

如何在多核计算机上解释boost :: timer :: cpu_timer的输出?

[英]How to interpret the output of boost::timer::cpu_timer on multicore machine?

I use boost::timer::cpu_timer to measure the performance of some algorithm in my application. 我使用boost::timer::cpu_timer来衡量我的应用程序中某些算法的性能。 The example output looks like this: 示例输出如下所示:

Algo1 duration: 6.755457s wall, 12.963683s user + 1.294808s system = 14.258491s CPU (211.1%) Algo1持续时间:墙6.755457s,用户12.963683s + 1.294808s系统= 14.258491s CPU(211.1%)

From boost cpu_timer documentation: 从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. 换句话说,此程序运行在5.713010秒内,这由墙上的时钟来衡量,操作系统为它收取了5.709637秒的用户CPU时间和0秒的系统CPU时间,这两者的总和为5.709637,并且占墙上时钟时间的99.9%。

What does the value I obtained mean (211.1%), does it mean that more than two cores were involved in execution of my algorithm ? 我获得的值(211.1%)是什么意思,是否意味着我的算法执行涉及两个以上的内核?

What is the meaning of user CPU time and system CPU time ? user CPU timesystem CPU time是什么意思?

What does the value I obtained mean (211.1%), does it mean that more than two cores were involved in execution of my algorithm ? 我获得的值(211.1%)是什么意思,是否意味着我的算法执行涉及两个以上的内核?

It means that program used a little bit more than twice as much CPU time as wall time. 这意味着该程序使用的CPU时间是墙时间的两倍多。 For that to happen, it must have been running on at least three cores for some of that time. 为此,它必须已经在至少三个内核上运行了一段时间。

What is the meaning of user CPU time and system CPU time ? 用户CPU时间和系统CPU时间是什么意思?

User CPU time is time when the CPU is running user code. 用户CPU时间是CPU运行用户代码的时间。 System CPU time is time when the CPU is running system code. 系统CPU时间是CPU运行系统代码的时间。 When you call a system function, like the function to read from a file, you switch from running user code to running system code until that function returns. 调用系统功能(例如从文件读取的功能)时,您将从运行的用户代码切换到运行的系统代码,直到该函数返回为止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM