mirror of
https://github.com/flatcar/scripts.git
synced 2025-11-27 13:31:56 +01:00
parallel_emerge: print total time and load in status output
TEST=run build_packages/build_image BUG=none Review URL: http://codereview.chromium.org/2946003
This commit is contained in:
parent
b5643e8bf6
commit
2e1f24ba3e
@ -67,6 +67,9 @@ BOARD = None
|
||||
VERBOSE = False
|
||||
AUTOCLEAN = False
|
||||
|
||||
# Global start time
|
||||
GLOBAL_START = time.time()
|
||||
|
||||
|
||||
def ParseArgs(argv):
|
||||
"""Set global vars based on command line.
|
||||
@ -473,11 +476,18 @@ class EmergeQueue(object):
|
||||
self._retry_queue = []
|
||||
self._failed = {}
|
||||
|
||||
def _LoadAvg(self):
|
||||
loads = open('/proc/loadavg', 'r').readline().split()[:3]
|
||||
return ' '.join(loads)
|
||||
|
||||
def _Status(self):
|
||||
"""Print status."""
|
||||
print "Pending %s, Ready %s, Running %s, Retrying %s, Total %s" % (
|
||||
seconds = time.time() - GLOBAL_START
|
||||
print "Pending %s, Ready %s, Running %s, Retrying %s, Total %s " \
|
||||
"[Time %dm%ds Load %s]" % (
|
||||
len(self._deps_map), len(self._emerge_queue),
|
||||
len(self._jobs), len(self._retry_queue), self._total_jobs)
|
||||
len(self._jobs), len(self._retry_queue), self._total_jobs,
|
||||
seconds / 60, seconds % 60, self._LoadAvg())
|
||||
|
||||
def _LaunchOneEmerge(self, target):
|
||||
"""Run emerge --nodeps to do a single package install.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user