Francesco Romani has uploaded a new change for review. Change subject: WIP: sampling: add last_pair() method to SampleWindow ......................................................................
WIP: sampling: add last_pair() method to SampleWindow HostStats thread need to access the last two stored samples. To cope with this requirement, add last_pair() to SampleWindow class. Change-Id: If73a6c0dc3503f6bcb02300517bbd2ff1424bcc3 Signed-off-by: Francesco Romani <from...@redhat.com> --- M vdsm/virt/sampling.py 1 file changed, 7 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/40427/1 diff --git a/vdsm/virt/sampling.py b/vdsm/virt/sampling.py index 710bba9..d59ce2c 100644 --- a/vdsm/virt/sampling.py +++ b/vdsm/virt/sampling.py @@ -366,6 +366,13 @@ _, last_sample = self._samples[-1] return last_sample + def last_pair(self): + if len(self._samples) < 2: + return None, None + _, prev_last_sample = self._samples[-2] + _, last_sample = self._samples[-1] + return prev_last_sample, last_sample + StatsSample = namedtuple('StatsSample', ['first_value', 'last_value', -- To view, visit https://gerrit.ovirt.org/40427 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If73a6c0dc3503f6bcb02300517bbd2ff1424bcc3 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Francesco Romani <from...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches