[Engine-devel] Consider iowait add into usage CPU percentage
Liao, Chuan (Jason Liao, HPservers-Core-OE-PSC)
chuan.liao at hp.com
Wed Mar 12 02:09:59 UTC 2014
Hi All,
Any feedback for this topic?
Add Doron and Martin in the mail list.
Best Regards,
Jason Liao
From: vdsm-devel-bounces at lists.fedorahosted.org [mailto:vdsm-devel-bounces at lists.fedorahosted.org] On Behalf Of Liao, Chuan (Jason Liao, HPservers-Core-OE-PSC)
Sent: 2014年3月11日 14:02
To: vdsm-devel; engine-devel at ovirt.org
Cc: Liang, Shang-Chun (David Liang, HPservers-Core-OE-PSC); Vinod, Chegu; Gilad Chaplik
Subject: [vdsm] Consider iowait add into usage CPU percentage
Hi All,
On engine core, The usage CPU percentage is calculated by %sys + %usr
class VdsBrokerObjectsBuilder
function updateVDSStatisticsData
vds.setCpuSys(AssignDoubleValue(xmlRpcStruct, VdsProperties.cpu_sys));
vds.setCpuUser(AssignDoubleValue(xmlRpcStruct, VdsProperties.cpu_user));
if (vds.getCpuSys() != null && vds.getCpuUser() != null) {
vds.setUsageCpuPercent((int) (vds.getCpuSys() + vds.getCpuUser()));
}
On vdsm, The %sys, %usr and %idle is calculated like below workflow,
class API
function getStats
decStats = self._cif._hostStats.get()
class clientIF
function __init__
self._hostStats = sampling.HostStatsThread(log=log)
self._hostStats.start()
class HostStatsThread
function get
hs0, hs1 = self._samples[0], self._samples[-1]
…
jiffies = (hs1.totcpu.user - hs0.totcpu.user) % (2 ** 32)
stats['cpuUser'] = jiffies / interval / self._ncpus
jiffies = (hs1.totcpu.sys - hs0.totcpu.sys) % (2 ** 32)
stats['cpuSys'] = jiffies / interval / self._ncpus
stats['cpuIdle'] = max(0.0, 100.0 - stats['cpuUser'] - stats['cpuSys'])
class HostSample
function __init__
self.totcpu = TotalCpuSample()
class TotalCpuSample
function __init__
self.user, userNice, self.sys, self.idle = \
map(int, file('/proc/stat').readline().split()[1:5])
self.user += userNice
Question1: Why stats[‘cpuIdle’] do not use the sampling data totcpu.idle for calculating?
Question2: There is another data named iowait in /proc/stat, do we need to consider add this into usage CPU percentage for calculating?
Best Regards,
Jason Liao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/engine-devel/attachments/20140312/6b6441ab/attachment.html>
More information about the Engine-devel
mailing list