[bitbake-devel] [PATCH] bitbake: knotty: Show elapsed time for tasks with progressbar
Ola x Nilsson
ola.x.nilsson at axis.com
Wed Apr 12 16:03:01 UTC 2017
Signed-off-by: Ola x Nilsson <olani at axis.com>
---
bitbake/lib/bb/ui/knotty.py | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index 948f527..4caeafa 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -32,6 +32,7 @@ import fcntl
import struct
import copy
import atexit
+import re
from bb.ui import uihelper
@@ -248,10 +249,10 @@ class TerminalFilter(object):
start_time = activetasks[t].get("starttime", None)
if not pbar or pbar.bouncing != (progress < 0):
if progress < 0:
- pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2, resize_handler=self.sigwinch_handle)
+ pbar = BBProgress("0: %s - 0s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.BouncingSlider(), ''], extrapos=2, resize_handler=self.sigwinch_handle)
pbar.bouncing = True
else:
- pbar = BBProgress("0: %s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=4, resize_handler=self.sigwinch_handle)
+ pbar = BBProgress("0: %s - 0s (pid %s) " % (activetasks[t]["title"], t), 100, widgets=[progressbar.Percentage(), ' ', progressbar.Bar(), ''], extrapos=4, resize_handler=self.sigwinch_handle)
pbar.bouncing = False
activetasks[t]["progressbar"] = pbar
tasks.append((pbar, progress, rate, start_time))
@@ -292,7 +293,10 @@ class TerminalFilter(object):
pbar.start(False)
if start_time:
pbar.start_time = start_time
- pbar.setmessage('%s:%s' % (tasknum, pbar.msg.split(':', 1)[1]))
+ m = re.match(r'\d+: (.*) - \d+s (\(pid \d+\))', pbar.msg)
+ pbar.setmessage('%s: %s - %ds %s' %
+ (tasknum, m.group(1),
+ currenttime - pbar.start_time, m.group(2)))
if progress > -1:
pbar.setextra(rate)
content = pbar.update(progress)
--
2.1.4
More information about the bitbake-devel
mailing list