简体   繁体   中英

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. The example output looks like this:

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

From boost cpu_timer documentation:

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.

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

What is the meaning of user CPU time and system 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 ?

It means that program used a little bit more than twice as much CPU time as wall time. 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 ?

User CPU time is time when the CPU is running user code. System CPU time is time when the CPU is running system code. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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