diff options
| author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2022-04-04 14:11:51 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-04-05 10:50:08 +0100 |
| commit | 12b4074675bc8794650ebc9fbb9f3af6c5cc3b15 (patch) | |
| tree | e12bfecfafbf34becde31ec921211b8e6afe032c | |
| parent | e4c16d11128f0e9cc2567fc9e3579e9a94988b2e (diff) | |
| download | poky-12b4074675bc8794650ebc9fbb9f3af6c5cc3b15.tar.gz | |
bitbake: knotty.py: Show elapsed time also for tasks with progress bars
While the progress bar is good at conveying information about how much
of a task has executed, the elapsed time of the task is still very
much relevant to show.
(Bitbake rev: 41eeb4f34fb2306303f7688ec5e0ae965a573aa4)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index b2e7520ee7..3f410fd525 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
| @@ -252,26 +252,26 @@ class TerminalFilter(object): | |||
| 252 | return | 252 | return |
| 253 | tasks = [] | 253 | tasks = [] |
| 254 | for t in runningpids: | 254 | for t in runningpids: |
| 255 | start_time = activetasks[t].get("starttime", None) | ||
| 256 | if start_time: | ||
| 257 | msg = "%s - %s (pid %s)" % (activetasks[t]["title"], self.elapsed(currenttime - start_time), activetasks[t]["pid"]) | ||
| 258 | else: | ||
| 259 | msg = "%s (pid %s)" % (activetasks[t]["title"], activetasks[t]["pid"]) | ||
| 255 | progress = activetasks[t].get("progress", None) | 260 | progress = activetasks[t].get("progress", None) |
| 256 | if progress is not None: | 261 | if progress is not None: |
| 257 | pbar = activetasks[t].get("progressbar", None) | 262 | pbar = activetasks[t].get("progressbar", None) |
| 258 | rate = activetasks[t].get("rate", None) | 263 | rate = activetasks[t].get("rate", None) |
| 259 | start_time = activetasks[t].get("starttime", None) | ||
| 260 | if not pbar or pbar.bouncing != (progress < 0): | 264 | if not pbar or pbar.bouncing != (progress < 0): |
| 261 | if progress < 0: | 265 | if progress < 0: |
| 262 | pbar = BBProgress("0: %s (pid %s)" % (activetasks[t]["title"], activetasks[t]["pid"]), 100, widgets=[' ', progressbar.BouncingSlider(), ''], extrapos=3, resize_handler=self.sigwinch_handle) | 266 | pbar = BBProgress("0: %s" % msg, 100, widgets=[' ', progressbar.BouncingSlider(), ''], extrapos=3, resize_handler=self.sigwinch_handle) |
| 263 | pbar.bouncing = True | 267 | pbar.bouncing = True |
| 264 | else: | 268 | else: |
| 265 | pbar = BBProgress("0: %s (pid %s)" % (activetasks[t]["title"], activetasks[t]["pid"]), 100, widgets=[' ', progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=5, resize_handler=self.sigwinch_handle) | 269 | pbar = BBProgress("0: %s" % msg, 100, widgets=[' ', progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=5, resize_handler=self.sigwinch_handle) |
| 266 | pbar.bouncing = False | 270 | pbar.bouncing = False |
| 267 | activetasks[t]["progressbar"] = pbar | 271 | activetasks[t]["progressbar"] = pbar |
| 268 | tasks.append((pbar, progress, rate, start_time)) | 272 | tasks.append((pbar, msg, progress, rate, start_time)) |
| 269 | else: | 273 | else: |
| 270 | start_time = activetasks[t].get("starttime", None) | 274 | tasks.append(msg) |
| 271 | if start_time: | ||
| 272 | tasks.append("%s - %s (pid %s)" % (activetasks[t]["title"], self.elapsed(currenttime - start_time), activetasks[t]["pid"])) | ||
| 273 | else: | ||
| 274 | tasks.append("%s (pid %s)" % (activetasks[t]["title"], activetasks[t]["pid"])) | ||
| 275 | 275 | ||
| 276 | if self.main.shutdown: | 276 | if self.main.shutdown: |
| 277 | content = pluralise("Waiting for %s running task to finish", | 277 | content = pluralise("Waiting for %s running task to finish", |
| @@ -308,12 +308,12 @@ class TerminalFilter(object): | |||
| 308 | if not self.quiet: | 308 | if not self.quiet: |
| 309 | for tasknum, task in enumerate(tasks[:(self.rows - 1 - lines)]): | 309 | for tasknum, task in enumerate(tasks[:(self.rows - 1 - lines)]): |
| 310 | if isinstance(task, tuple): | 310 | if isinstance(task, tuple): |
| 311 | pbar, progress, rate, start_time = task | 311 | pbar, msg, progress, rate, start_time = task |
| 312 | if not pbar.start_time: | 312 | if not pbar.start_time: |
| 313 | pbar.start(False) | 313 | pbar.start(False) |
| 314 | if start_time: | 314 | if start_time: |
| 315 | pbar.start_time = start_time | 315 | pbar.start_time = start_time |
| 316 | pbar.setmessage('%s:%s' % (tasknum, pbar.msg.split(':', 1)[1])) | 316 | pbar.setmessage('%s: %s' % (tasknum, msg)) |
| 317 | pbar.setextra(rate) | 317 | pbar.setextra(rate) |
| 318 | if progress > -1: | 318 | if progress > -1: |
| 319 | content = pbar.update(progress) | 319 | content = pbar.update(progress) |
