diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-22 13:54:43 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-09-23 15:01:56 +0100 |
commit | 0d76de85bd2fa8fc6b0a3a5a65f2817a5d0b2186 (patch) | |
tree | 0371adb88c426845f90bd7623afb9fb0a5acf130 | |
parent | c902e7b93700e56245d8f04397ff01fa278183a3 (diff) | |
download | poky-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>
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 11 |
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): | |||
170 | self.interactive = sys.stdout.isatty() | 170 | self.interactive = sys.stdout.isatty() |
171 | self.footer_present = False | 171 | self.footer_present = False |
172 | self.lastpids = [] | 172 | self.lastpids = [] |
173 | self.lasttime = None | ||
173 | self.quiet = quiet | 174 | self.quiet = quiet |
174 | 175 | ||
175 | if not self.interactive: | 176 | if not self.interactive: |
@@ -226,6 +227,10 @@ class TerminalFilter(object): | |||
226 | activetasks = self.helper.running_tasks | 227 | activetasks = self.helper.running_tasks |
227 | failedtasks = self.helper.failed_tasks | 228 | failedtasks = self.helper.failed_tasks |
228 | runningpids = self.helper.running_pids | 229 | runningpids = self.helper.running_pids |
230 | currenttime = time.time() | ||
231 | if not self.lasttime or (currenttime - self.lasttime > 5): | ||
232 | self.helper.needUpdate = True | ||
233 | self.lasttime = currenttime | ||
229 | if self.footer_present and not self.helper.needUpdate: | 234 | if self.footer_present and not self.helper.needUpdate: |
230 | return | 235 | return |
231 | self.helper.needUpdate = False | 236 | self.helper.needUpdate = False |
@@ -250,7 +255,11 @@ class TerminalFilter(object): | |||
250 | activetasks[t]["progressbar"] = pbar | 255 | activetasks[t]["progressbar"] = pbar |
251 | tasks.append((pbar, progress, rate, start_time)) | 256 | tasks.append((pbar, progress, rate, start_time)) |
252 | else: | 257 | else: |
253 | tasks.append("%s (pid %s)" % (activetasks[t]["title"], t)) | 258 | start_time = activetasks[t].get("starttime", None) |
259 | if start_time: | ||
260 | tasks.append("%s - %ds (pid %s)" % (activetasks[t]["title"], currenttime - start_time, t)) | ||
261 | else: | ||
262 | tasks.append("%s (pid %s)" % (activetasks[t]["title"], t)) | ||
254 | 263 | ||
255 | if self.main.shutdown: | 264 | if self.main.shutdown: |
256 | content = "Waiting for %s running tasks to finish:" % len(activetasks) | 265 | content = "Waiting for %s running tasks to finish:" % len(activetasks) |