summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPale Moon <git-repo@palemoon.org>2017-10-17 11:31:12 +0200
committerPale Moon <git-repo@palemoon.org>2017-10-17 12:28:42 +0200
commite6ea83af9ec1eff8f9cced801b63dfa45cf52f03 (patch)
tree138e860171c6f985d319393616364b794e752cf1
parent6442b2377b7f004bae13e47f13e6680e5389e373 (diff)
downloadpalemoon-gre-e6ea83af9ec1eff8f9cced801b63dfa45cf52f03.tar.gz
Convert resourcemonitor poll() to float, and break the loop immediately when done.
-rw-r--r--testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py b/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
index dd2d8f448..bf6d898b7 100644
--- a/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
+++ b/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py
@@ -256,13 +256,19 @@ class SystemResourceMonitor(object):
done = False
- while self._pipe.poll(1):
+ # The child process will send each data sample over the pipe
+ # as a separate data structure. When it has finished sending
+ # samples, it sends a special "done" message to indicate it
+ # is finished.
+ while self._pipe.poll(1.0):
start_time, end_time, io_diff, cpu_diff, cpu_percent, virt_mem, \
swap_mem = self._pipe.recv()
+ # There should be nothing after the "done" message so
+ # terminate.
if start_time == 'done':
done = True
- continue
+ break
io = self._io_type(*io_diff)
virt = self._virt_type(*virt_mem)