All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] knotty: show elapsed time on the task progress bar
@ 2026-08-18 19:39 WXbet
  2026-08-18 19:54 ` WXbet
  0 siblings, 1 reply; 2+ messages in thread
From: WXbet @ 2026-08-18 19:39 UTC (permalink / raw)
  To: bitbake-devel


[-- Attachment #1.1: Type: text/plain, Size: 464 bytes --]

As a convenience for the user, this makes it easy to see at a glance how long
the current build has already been running.

The progress bar for the overall build currently shows only a percentage and
a bar, with no running time — while each individual running-task line below
it already carries an elapsed-time value. The patch adds a Timer widget to
the bar, reusing knotty's existing time formatting so it matches the rest of
the UI.

Thanks,
WXbet

[-- Attachment #1.2: Type: text/html, Size: 539 bytes --]

[-- Attachment #2: 0001-knotty-show-elapsed-time-on-the-task-progress-bar.patch --]
[-- Type: application/octet-stream, Size: 2878 bytes --]

From 9302e85e75edc6af22ea90336d2b0c46fa95fe80 Mon Sep 17 00:00:00 2001
From: WXbet <57314510+WXbet@users.noreply.github.com>
Date: Tue, 18 Aug 2026 21:30:22 +0200
Subject: [PATCH] knotty: show elapsed time on the task progress bar

The progress bar for the overall build shows a percentage and a bar but no
elapsed time, even though the individual running-task lines below it each
show one.

Add a Timer widget to the bar. The time formatting in
TerminalFilter.elapsed() is hoisted to a module-level bb_elapsed() helper and
reused by a small progressbar.Timer subclass, so the bar prints the same
"%dh%dm%ds" style as the rest of the UI.

Signed-off-by: WXbet <57314510+WXbet@users.noreply.github.com>
---
 lib/bb/ui/knotty.py | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 15025e8dd..343045881 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -37,6 +37,21 @@ featureSet = [bb.cooker.CookerFeatures.SEND_SANITYEVENTS, bb.cooker.CookerFeatur
 logger = logging.getLogger("BitBake")
 interactive = sys.stdout.isatty()
 
+def bb_elapsed(sec):
+    hrs = int(sec / 3600.0)
+    sec -= hrs * 3600
+    min = int(sec / 60.0)
+    sec -= min * 60
+    if hrs > 0:
+        return "%dh%dm%ds" % (hrs, min, sec)
+    elif min > 0:
+        return "%dm%ds" % (min, sec)
+    else:
+        return "%ds" % (sec)
+
+class BBTimer(progressbar.Timer):
+    format_time = staticmethod(bb_elapsed)
+
 class BBProgress(progressbar.ProgressBar):
     def __init__(self, msg, maxval, widgets=None, extrapos=-1, resize_handler=None):
         self.id = msg
@@ -250,16 +265,7 @@ class TerminalFilter(object):
         self._footer_lines = None
 
     def elapsed(self, sec):
-        hrs = int(sec / 3600.0)
-        sec -= hrs * 3600
-        min = int(sec / 60.0)
-        sec -= min * 60
-        if hrs > 0:
-            return "%dh%dm%ds" % (hrs, min, sec)
-        elif min > 0:
-            return "%dm%ds" % (min, sec)
-        else:
-            return "%ds" % (sec)
+        return bb_elapsed(sec)
 
     def keepAlive(self, t):
         if not self.cuu:
@@ -354,7 +360,7 @@ class TerminalFilter(object):
                 msg = "Currently %2s running tasks (%s)" % (len(activetasks), cur_tasks)
             maxtask = self.helper.tasknumber_total
             if not self.main_progress or self.main_progress.maxval != maxtask:
-                widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar()]
+                widgets = [' ', progressbar.Percentage(), ' ', progressbar.Bar(), ' ', BBTimer(format='Elapsed: %s')]
                 self.main_progress = BBProgress("Running tasks", maxtask, widgets=widgets, resize_handler=self.sigwinch_handle)
                 self.main_progress.fd = self._footer_buf
                 self.main_progress.start(False)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] knotty: show elapsed time on the task progress bar
  2026-08-18 19:39 [PATCH] knotty: show elapsed time on the task progress bar WXbet
@ 2026-08-18 19:54 ` WXbet
  0 siblings, 0 replies; 2+ messages in thread
From: WXbet @ 2026-08-18 19:54 UTC (permalink / raw)
  To: bitbake-devel


[-- Attachment #1.1: Type: text/plain, Size: 2 bytes --]



[-- Attachment #1.2: Type: text/html, Size: 113 bytes --]

[-- Attachment #2: 0001-knotty-show-elapsed-time-on-the-task-progress-bar.png --]
[-- Type: image/png, Size: 170661 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-18 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 19:39 [PATCH] knotty: show elapsed time on the task progress bar WXbet
2026-08-18 19:54 ` WXbet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.