Mark Wu has posted comments on this change.
Change subject: report cpuUser and cpuSys separately
......................................................................
Patch Set 1: I would prefer that you didn't submit this
(4 inline comments)
....................................................
File vdsm/libvirtvm.py
Line 130: vmDrive.apparentsize =
int(volSize['apparentsize'])
Line 131:
Line 132: def _sampleCpu(self):
Line 133: cpuStats = self._vm._dom.getCPUStats(True, 0)
Line 134: self._log.info(cpuStats)
info level is too verbose?
Line 135: return cpuStats[0]
Line 136:
Line 137: def _sampleDisk(self):
Line 138: if not self._vm._volumesPrepared:
Line 166: return netSamples
Line 167:
Line 168: def _getCpuStats(self, stats):
Line 169: sInfo, eInfo, sampleInterval = self.sampleCpu.getStats()
Line 170: ticks=os.sysconf('SC_CLK_TCK')
white space is required before and after '=' according to PEP8.
Line 171: nanos=10000000
Line 172: cpuTime=0
Line 173:
Line 174: try:
Line 172: cpuTime=0
Line 173:
Line 174: try:
Line 175: stats['cpuUser'] = 100 * (eInfo['user_time'] -
sInfo['user_time']) / sampleInterval / nanos
Line 176: stats['cpuSys'] = 100 * (eInfo['system_time'] -
sInfo['system_time']) / sampleInterval / nanos
It's too long for PEP8. Please use the PEP8 tools to check it to make sure
it's PEP8 clean.
Line 177: cpuTime = 100 * (eInfo['cpu_time'] - sInfo['cpu_time']) /
sampleInterval / (nanos * ticks)
Line 178: except (TypeError, ZeroDivisionError) as e:
Line 179: self._log.debug("CPU stats not available: %s", e)
Line 180: stats['cpuUser'] = 0.0
Line 173:
Line 174: try:
Line 175: stats['cpuUser'] = 100 * (eInfo['user_time'] -
sInfo['user_time']) / sampleInterval / nanos
Line 176: stats['cpuSys'] = 100 * (eInfo['system_time'] -
sInfo['system_time']) / sampleInterval / nanos
Line 177: cpuTime = 100 * (eInfo['cpu_time'] - sInfo['cpu_time']) /
sampleInterval / (nanos * ticks)
I don't see why you need consider 'ticks' here. The unit of cpuTime should
already be nanoseconds.
Line 178: except (TypeError, ZeroDivisionError) as e:
Line 179: self._log.debug("CPU stats not available: %s", e)
Line 180: stats['cpuUser'] = 0.0
Line 181: stats['cpuSys'] = 0.0
--
To view, visit http://gerrit.ovirt.org/7718
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I663ad25ff3ff5ce426b5159b6c9a65b7f5167605
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Laszlo Hornyak <[email protected]>
Gerrit-Reviewer: Mark Wu <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches