Francesco Romani has uploaded a new change for review. Change subject: sampling: host stats: switch to monotonic_time ......................................................................
sampling: host stats: switch to monotonic_time Makes the time stamping function injectable, and default to monotonic_time. The resolution of monotonic_time is sufficient for the task of host stats, and it is a bit more robust. Also, test becomes easier if the time stamping code is injectable. Change-Id: I4ca60654836018f040b7aa1b506b3479a0f4c996 Signed-off-by: Francesco Romani <[email protected]> --- M vdsm/virt/sampling.py 1 file changed, 4 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/01/40901/1 diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py index 2eedee1..cb5527c 100644 --- a/vdsm/virt/sampling.py +++ b/vdsm/virt/sampling.py @@ -546,9 +546,10 @@ class HostMonitor(object): _connlog = logging.getlogger('connectivity') - def __init__(self, log): + def __init__(self, log, clock=utils.monotonic_time): self._log = log - self._start_time = time.time() + self._clock = clock + self._start_time = self._clock() self._samples = SampleWindow(size=5) self._pid = os.getpid() @@ -584,7 +585,7 @@ 'txRate': 0.0, # REQUIRED_FOR: engine < 3.6 'cpuSysVdsmd': 0.0, 'cpuUserVdsmd': 0.0, - 'elapsedTime': int(time.time() - self._start_time) + 'elapsedTime': int(self._clock() - self._start_time) } if len(self._samples) < 2: -- To view, visit https://gerrit.ovirt.org/40901 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I4ca60654836018f040b7aa1b506b3479a0f4c996 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
