Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: parallel_emerge

Issue 2946003: parallel_emerge: print total time and load in status output (Closed) Base URL: http://src.chromium.org/git/crosutils.git
Patch Set: Style fixes Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: parallel_emerge
diff --git a/parallel_emerge b/parallel_emerge
index dbcdb7a6cbcc59089c2b6144a365b54d253374dd..c3312684f97596c3c7d66dd65ca99de27436cebc 100755
--- a/parallel_emerge
+++ b/parallel_emerge
@@ -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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698