1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-10 04:00:28 +00:00

bitbake: knotty: Use 40 Hz refresh rate (FPS) for footer update.

Refresh footer in 40 Hz to avoid heavy print() flooding but keep it fluent for human eyes.

(Bitbake rev: c36efdf642d858c6997819744d00a3c1965c6417)

Signed-off-by: Benjamin Szőke <egyszeregy@freemail.hu>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Benjamin Szőke
2025-01-25 13:27:51 +01:00
committed by Richard Purdie
parent c5977954a8
commit 48e771c4a6
+20 -4
View File
@@ -128,6 +128,10 @@ class InteractConsoleLogFilter(logging.Filter):
return True
class TerminalFilter(object):
# 40 Hz (FPS) -> 0.025 secs
_DEFAULT_PRINT_INTERVAL = 0.025
rows = 25
columns = 80
@@ -166,7 +170,7 @@ class TerminalFilter(object):
self.interactive = sys.stdout.isatty()
self.footer_present = False
self.lastpids = []
self.lasttime = None
self.lasttime = time.time()
self.quiet = quiet
self._footer_buf = io.StringIO()
@@ -251,11 +255,23 @@ class TerminalFilter(object):
failedtasks = self.helper.failed_tasks
runningpids = self.helper.running_pids
currenttime = time.time()
if not self.lasttime or (currenttime - self.lasttime > 5):
deltatime = currenttime - self.lasttime
if (deltatime > 5.0):
self.helper.needUpdate = True
self.lasttime = currenttime
if self.footer_present and not self.helper.needUpdate:
need_update = self.helper.needUpdate
else:
# Do not let to update faster then _DEFAULT_PRINT_INTERVAL
# to avoid heavy print() flooding.
need_update = self.helper.needUpdate and (deltatime > self._DEFAULT_PRINT_INTERVAL)
if self.footer_present and (not need_update):
# Footer update is not need.
return
else:
# Footer update is need and store its "lasttime" value.
self.lasttime = currenttime
self.helper.needUpdate = False
if (not self.helper.tasknumber_total or self.helper.tasknumber_current == self.helper.tasknumber_total) and not len(activetasks):
self.clearFooter()