summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-22 13:54:43 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-09-23 15:01:56 +0100
commit0d76de85bd2fa8fc6b0a3a5a65f2817a5d0b2186 (patch)
tree0371adb88c426845f90bd7623afb9fb0a5acf130 /bitbake/lib/bb/ui
parentc902e7b93700e56245d8f04397ff01fa278183a3 (diff)
downloadopenembedded-core-contrib-0d76de85bd2fa8fc6b0a3a5a65f2817a5d0b2186.tar.gz
bitbake: knotty: Show task elapsed time
Its often useful to know how long a task has been running for. This patch adds that information to the task display, updating every 5s if there were no other updates so the user can see how long tasks have been running for. [YOCTO #9737] (Bitbake rev: 6c42025e5dd7761213be3f82f3252a7892d2239d) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rw-r--r--bitbake/lib/bb/ui/knotty.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index a1856ecd77..79325bb6e4 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -170,6 +170,7 @@ class TerminalFilter(object):
self.interactive = sys.stdout.isatty()
self.footer_present = False
self.lastpids = []
+ self.lasttime = None
self.quiet = quiet
if not self.interactive:
@@ -226,6 +227,10 @@ class TerminalFilter(object):
activetasks = self.helper.running_tasks
failedtasks = self.helper.failed_tasks
runningpids = self.helper.running_pids
+ currenttime = time.time()
+ if not self.lasttime or (currenttime - self.lasttime > 5):
+ self.helper.needUpdate = True
+ self.lasttime = currenttime
if self.footer_present and not self.helper.needUpdate:
return
self.helper.needUpdate = False
@@ -250,7 +255,11 @@ class TerminalFilter(object):
activetasks[t]["progressbar"] = pbar
tasks.append((pbar, progress, rate, start_time))
else:
- tasks.append("%s (pid %s)" % (activetasks[t]["title"], t))
+ start_time = activetasks[t].get("starttime", None)
+ if start_time:
+ tasks.append("%s - %ds (pid %s)" % (activetasks[t]["title"], currenttime - start_time, t))
+ else:
+ tasks.append("%s (pid %s)" % (activetasks[t]["title"], t))
if self.main.shutdown:
content = "Waiting for %s running tasks to finish:" % len(activetasks)