Francesco Romani has uploaded a new change for review.
Change subject: sampling: rename variables for clarity
......................................................................
sampling: rename variables for clarity
Rename:
hs0 -> first_sample
hs1 -> last_sample
for clarity, and to conform to naming used elsewhere in the
module/package. No changes in logic.
Change-Id: I24d07414c96dcd047966bb28cd2f756640692f1c
Signed-off-by: Francesco Romani <fromani(a)redhat.com>
---
M vdsm/virt/sampling.py
1 file changed, 17 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/19/41219/1
diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py
index 9ad6143..1ee485e 100644
--- a/vdsm/virt/sampling.py
+++ b/vdsm/virt/sampling.py
@@ -613,37 +613,41 @@
'elapsedTime': int(time.time() - self.startTime)
}
- hs0, hs1, _ = self._samples.stats()
+ first_sample, last_sample, _ = self._samples.stats()
# we need a different interval, see below
- if hs0 is None or hs1 is None:
+ if first_sample is None or last_sample is None:
return stats
stats.update(self._getInterfacesStats())
- interval = hs1.timestamp - hs0.timestamp
+ interval = last_sample.timestamp - first_sample.timestamp
- jiffies = (hs1.pidcpu.user - hs0.pidcpu.user) % (2 ** 32)
+ jiffies = (
+ last_sample.pidcpu.user - first_sample.pidcpu.user) % (2 ** 32)
stats['cpuUserVdsmd'] = jiffies / interval
- jiffies = (hs1.pidcpu.sys - hs0.pidcpu.sys) % (2 ** 32)
+ jiffies = (
+ last_sample.pidcpu.sys - first_sample.pidcpu.sys) % (2 ** 32)
stats['cpuSysVdsmd'] = jiffies / interval
- jiffies = (hs1.totcpu.user - hs0.totcpu.user) % (2 ** 32)
+ jiffies = (
+ last_sample.totcpu.user - first_sample.totcpu.user) % (2 ** 32)
stats['cpuUser'] = jiffies / interval / self._ncpus
- jiffies = (hs1.totcpu.sys - hs0.totcpu.sys) % (2 ** 32)
+ jiffies = (
+ last_sample.totcpu.sys - first_sample.totcpu.sys) % (2 ** 32)
stats['cpuSys'] = jiffies / interval / self._ncpus
stats['cpuIdle'] = max(0.0,
100.0 - stats['cpuUser'] -
stats['cpuSys'])
- stats['memUsed'] = hs1.memUsed
- stats['anonHugePages'] = hs1.anonHugePages
- stats['cpuLoad'] = hs1.cpuLoad
+ stats['memUsed'] = last_sample.memUsed
+ stats['anonHugePages'] = last_sample.anonHugePages
+ stats['cpuLoad'] = last_sample.cpuLoad
- stats['diskStats'] = hs1.diskStats
- stats['thpState'] = hs1.thpState
+ stats['diskStats'] = last_sample.diskStats
+ stats['thpState'] = last_sample.thpState
if self._boot_time():
stats['bootTime'] = self._boot_time()
- stats['numaNodeMemFree'] = hs1.numaNodeMem.nodesMemSample
+ stats['numaNodeMemFree'] = last_sample.numaNodeMem.nodesMemSample
stats['cpuStatistics'] = self._getCpuCoresStats()
stats['v2vJobs'] = v2v.get_jobs_status()
--
To view, visit
https://gerrit.ovirt.org/41219
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I24d07414c96dcd047966bb28cd2f756640692f1c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani(a)redhat.com>