Determine CPU utilization(%) from CPU time given by VTune

Determine CPU utilization(%) from CPU time given by VTune

Currently i am working with Vtune. I am trying to calculate CPU% utilization give the "CPU seconds used" and the elapsed time.

Is this write :  CPU% = cpu time(secs) / elapsed time. ?

e.g. in 2 core machine

cpu sec =5.6 , elapsed time = 8.4

cpu% = 5.6 / 8.4 .

Also how to map cpu time and utilization in multicore environment.

Thanks,

rupinder

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

No. They are total differenr concepts. Let me explain more -

1. Elapsed time = end time - start time (profiling)

2. CPU time of function : captured samples of function * interval . For example, if you got 100 samples in f1(), and interval is 10ms as default. So CPU time of f1() = 100 * 10ms = 1s

3. CPU Utilization : time period from function's entry & exit, it lasts 2s. As I said f1() took 1s in one core, so CPU utilization is 50% (probably instruction was suspended, IO waits, etc)

4. Same situation for multicore, if the system is 2 cores, Full utilization is 200%, follow the point 3, meanwhile if 

a) Other function ran 2s on another core, so CPU utilization is 3s / 2s = 150%

b) Other function ran 1s on another core, so CPU utilization is 2s / 2s = 100%

c) No other function run on another core, so CPU utilization is 1s / 2s = 50%. 

Please observe timeline report to view these data. 

>>>3. CPU Utilization : time period from function's entry & exit, it lasts 2s. As I said f1() took 1s in one core, so CPU utilization is 50% (probably instruction was suspended, IO waits>>>, etc)

I would like to know what is time scale granularity of CPU utilization measurement?What happens for example when current executting function's thread is swapped out and other thread is scheduled to run?

Login to leave a comment.