Dan Kenigsberg has uploaded a new change for review.
Change subject: sampling: StatsThread: dropped unused methods ......................................................................
sampling: StatsThread: dropped unused methods
This is only a first step twards removal of the useless base class StatsThread.
Change-Id: Id92031ea787aa41a97f7a1ab488065b06f29673e Signed-off-by: Dan Kenigsberg danken@redhat.com --- M vdsm/sampling.py 1 file changed, 9 insertions(+), 19 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/72/20672/1
diff --git a/vdsm/sampling.py b/vdsm/sampling.py index 0a0ab9c..2849e75 100644 --- a/vdsm/sampling.py +++ b/vdsm/sampling.py @@ -364,12 +364,10 @@ """ AVERAGING_WINDOW = 5 SAMPLE_INTERVAL_SEC = 2 - MBITTOBYTES = 1000000 / 8
def __init__(self, log, ifids, ifrates): threading.Thread.__init__(self) self._log = log - self._lastCheckTime = 0 self._stopEvent = threading.Event() self._samples = [] self._ifids = ifids @@ -377,17 +375,10 @@ self._ncpus = 1 # in bytes-per-second self._lineRate = (sum(ifrates) or 1000) * (10 ** 6) / 8 - self._paused = False self._lastSampleTime = time.time()
def stop(self): self._stopEvent.set() - - def pause(self): - self._paused = True - - def cont(self): - self._paused = False
def sample(self): # override pass @@ -398,16 +389,15 @@ # wait a bit before starting to sample time.sleep(self.SAMPLE_INTERVAL_SEC) while not self._stopEvent.isSet(): - if not self._paused: - try: - sample = self.sample() - self._samples.append(sample) - self._lastSampleTime = sample.timestamp - if len(self._samples) > self.AVERAGING_WINDOW: - self._samples.pop(0) - except vm.TimeoutError: - self._log.error("Timeout while sampling stats", - exc_info=True) + try: + sample = self.sample() + self._samples.append(sample) + self._lastSampleTime = sample.timestamp + if len(self._samples) > self.AVERAGING_WINDOW: + self._samples.pop(0) + except vm.TimeoutError: + self._log.error("Timeout while sampling stats", + exc_info=True) self._stopEvent.wait(self.SAMPLE_INTERVAL_SEC) except: if not self._stopEvent.isSet():
oVirt Jenkins CI Server has posted comments on this change.
Change subject: sampling: StatsThread: dropped unused methods ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/5124/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit_el/4320/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/5198/ : SUCCESS
Petr Šebek has posted comments on this change.
Change subject: sampling: StatsThread: dropped unused methods ......................................................................
Patch Set 1: Verified+1 Code-Review+1
VdsStats works as should. Pausing thread is not used anywhere so it's needless, same of constant MBITOBYTES.
Dan Kenigsberg has posted comments on this change.
Change subject: sampling: StatsThread: dropped unused methods ......................................................................
Patch Set 1: Code-Review+2
Dan Kenigsberg has submitted this change and it was merged.
Change subject: sampling: StatsThread: dropped unused methods ......................................................................
sampling: StatsThread: dropped unused methods
This is only a first step twards removal of the useless base class StatsThread.
Change-Id: Id92031ea787aa41a97f7a1ab488065b06f29673e Signed-off-by: Dan Kenigsberg danken@redhat.com Reviewed-on: http://gerrit.ovirt.org/20672 Tested-by: Petr Šebek psebek@redhat.com Reviewed-by: Petr Šebek psebek@redhat.com --- M vdsm/sampling.py 1 file changed, 9 insertions(+), 19 deletions(-)
Approvals: Petr Šebek: Verified; Looks good to me, but someone else must approve Dan Kenigsberg: Looks good to me, approved
vdsm-patches@lists.fedorahosted.org