All of lore.kernel.org
 help / color / mirror / Atom feed
From: "WXbet" <WXbet@proton.me>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH] knotty: show elapsed time on the task progress bar
Date: Tue, 18 Aug 2026 12:39:04 -0700	[thread overview]
Message-ID: <sCTK.1787081944669538524.zSRd@lists.openembedded.org> (raw)


[-- 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


             reply	other threads:[~2026-08-18 19:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-18 19:39 WXbet [this message]
2026-08-18 19:54 ` [PATCH] knotty: show elapsed time on the task progress bar WXbet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sCTK.1787081944669538524.zSRd@lists.openembedded.org \
    --to=wxbet@proton.me \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.