Algorithm for 'CPU efficiency'

Started by Richard Haselgrove, August 19, 2015, 04:55:47 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Richard Haselgrove

Fred, please could you post (or email me) the algorithm you use for calculating the CPU efficiency of an individual running BOINC task?

It would be useful for the CERN projects which run their own tasks inside a virtual machine: a script monitoring CPU efficiency could tell whether the CERN server was keeping the VM supplied with tasks, and trigger a tweak to <max_ncpus_pct> (by swapping global_prefs_override.xml files) to allow another BOINC project to use the VM core when idle.

fred

Quote from: Richard Haselgrove on August 19, 2015, 04:55:47 PM
Fred, please could you post (or email me) the algorithm you use for calculating the CPU efficiency of an individual running BOINC task?
You mean the column CPU %?


Richard Haselgrove


fred

Quote from: Richard Haselgrove on August 20, 2015, 08:07:24 AM
Yes, that would be the one.
What you have to do is sample the elapsed time of that task.
Start a timer and after a certain amount of time sample again.
But that depends how the task time progresses. If it progresses badly your results will be vary inaccurate.
A longer sampling time may be needed.
Basically you have the percentage right away.
Don't know it will work as you have to know how the virtual machine uses resources.

What probably works more accurate is monitoring the virtual machine itself, see how much of the CPU it's using.


Richard Haselgrove

#4
Yes, I thought that might be the case. I think your predecessor - BoincView - averages the last ten sample points: I have the sample interval set at 30 seconds, and it can take 5 minutes for a new task to settle.

I can't find a scriptable way of monitoring a single process in Windows. Somebody on the CMS-dev board suggested

wmic cpu get loadpercentage

but that just gets the total machine loading - not even 'per core'. I got as far as

wmic process where name="vboxheadless.exe" get UserModeTime

(no loadpercentage available) - but then we're back to interval timing, so we may as well do it using the BOINC tools. boinccmd's --get_simple_gui_info output:

Quote======== Tasks ========
1) -----------
   name: CMS_4352_1427806758.445768_0
   WU name: CMS_4352_1427806758.445768
   project URL: http://boincai05.cern.ch/CMS-dev/
   report deadline: Wed Aug 26 09:28:07 2015
   ready to report: no
   got server ack: no
   final CPU time: 0.000000
   state: downloaded
   scheduler state: scheduled
   exit_status: 0
   signal: 0
   suspended via GUI: no
   active_task_state: EXECUTING
   app version num: 4617
   checkpoint CPU time: 18508.660000
   current CPU time: 18557.180000
   fraction done: 0.233817
   swap size: 117 MB
   working set size: 477 MB
   estimated CPU time remaining: 52081.563976

is probably good enough for now.

But hang on - where's elapsed time? Don't tell me that David has recycled a label again?

Edit - no, panic over. CPU time is CPU time - the one I'm looking for. Elapsed time is simply missing.

fred

Quote from: Richard Haselgrove on August 20, 2015, 10:40:55 AM
But hang on - where's elapsed time? Don't tell me that David has recycled a label again?
Got 2 doubles only valid on a running task:
elapsed_time
current_cpu_time

Ratio = delta current_cpu_time / delta elapsed_time

Richard Haselgrove

Quote from: fred on August 20, 2015, 10:56:33 AM
Quote from: Richard Haselgrove on August 20, 2015, 10:40:55 AM
But hang on - where's elapsed time? Don't tell me that David has recycled a label again?
Got 2 doubles only valid on a running task:
elapsed_time
current_cpu_time

Ratio = delta current_cpu_time / delta elapsed_time

Perhaps they added elapsed_time to the GUI RPC output, but didn't retro-fit it to boinccmd? I picked "--get_simple_gui_info", because that *only* outputs running tasks ("active_task_state: EXECUTING") - but elapsed time is missing for the --tasks output too. I'll do some more digging around.