OpenVZ Forum


Home » General » Support » Measuring CPU usage
Re: Measuring CPU usage [message #35194 is a reply to message #34870] Mon, 09 March 2009 15:34 Go to previous message
gurtaj is currently offline  gurtaj
Messages: 12
Registered: September 2008
Location: London, Ontario, Canada
Junior Member
# CPU_USAGE_% = [(NEW_USED - OLD_USED) / CPU_MHZ] / [(NEW_UPTIME - OLD_UPTIME) / CPU_MHZ]
cpuUsage = (float(newCont.getUsedtime() - oldUsedtime) / cpuCycles) / (float(newCont.getUptime() - oldUptime) / cpuCycles)


The other day I was doing some refactoring of the code and suddenly realized that it was kind of stupid what I did in that formula: dividing both terms by CPU_MHZ.

I believe the rest remained the same.
 
Read Message
Read Message
Previous Topic: RTNETLINK answers: File exists for veth interface
Next Topic: Accessing host directory/parition from VPS
Goto Forum:
  


Current Time: Tue Sep 16 22:34:15 GMT 2025

Total time taken to generate the page: 0.64817 seconds