[sysmon] Move osinfo cycles logic
Having this logic split across two different places is unnecessary;
its more sane to put all of the logic right next to where the osinfo
metric is collected.
Since this metric isnt time sensitive (we dont care if we sometimes
collect it every 60 or 59 or 61 minutes), we use a very simple check.
BUG=chromium:655796
TEST=Run sysmon
Change-Id: Ic8fa07e5e04934bf22331a9cf20d5f4b38c87a64
Reviewed-on: https://chromium-review.googlesource.com/421571
Commit-Ready: Allen Li <ayatane@chromium.org>
Tested-by: Allen Li <ayatane@chromium.org>
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
diff --git a/scripts/sysmon/loop.py b/scripts/sysmon/loop.py
index e96dfe4..cfff30b 100644
--- a/scripts/sysmon/loop.py
+++ b/scripts/sysmon/loop.py
@@ -25,12 +25,11 @@
"""
self._callback = callback
self._interval = interval
- self._cycles = 0
def loop_once(self):
"""Do actions for a single loop."""
try:
- self._callback(self._cycles)
+ self._callback()
except Exception:
logger.exception('Error during loop.')
@@ -38,7 +37,6 @@
while True:
self.loop_once()
_force_sleep(self._interval)
- self._cycles = (self._cycles + 1) % 60
def _force_sleep(secs):