diff options
| author | Benjamin Szőke <egyszeregy@freemail.hu> | 2025-01-25 13:27:51 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-08-19 11:33:23 +0100 |
| commit | 48e771c4a6a21373d5070453cb1482e68b30ce56 (patch) | |
| tree | 2a45f1b3b23c7c4653d10f99bdaab9cb07896a78 /bitbake/lib/bb/ui | |
| parent | c5977954a800957bae519d88b5af54578f93cfb4 (diff) | |
| download | poky-48e771c4a6a21373d5070453cb1482e68b30ce56.tar.gz | |
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>
Diffstat (limited to 'bitbake/lib/bb/ui')
| -rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index c4ab553a3a..732540b462 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
| @@ -128,6 +128,10 @@ class InteractConsoleLogFilter(logging.Filter): | |||
| 128 | return True | 128 | return True |
| 129 | 129 | ||
| 130 | class TerminalFilter(object): | 130 | class TerminalFilter(object): |
| 131 | |||
| 132 | # 40 Hz (FPS) -> 0.025 secs | ||
| 133 | _DEFAULT_PRINT_INTERVAL = 0.025 | ||
| 134 | |||
| 131 | rows = 25 | 135 | rows = 25 |
| 132 | columns = 80 | 136 | columns = 80 |
| 133 | 137 | ||
| @@ -166,7 +170,7 @@ class TerminalFilter(object): | |||
| 166 | self.interactive = sys.stdout.isatty() | 170 | self.interactive = sys.stdout.isatty() |
| 167 | self.footer_present = False | 171 | self.footer_present = False |
| 168 | self.lastpids = [] | 172 | self.lastpids = [] |
| 169 | self.lasttime = None | 173 | self.lasttime = time.time() |
| 170 | self.quiet = quiet | 174 | self.quiet = quiet |
| 171 | 175 | ||
| 172 | self._footer_buf = io.StringIO() | 176 | self._footer_buf = io.StringIO() |
| @@ -251,11 +255,23 @@ class TerminalFilter(object): | |||
| 251 | failedtasks = self.helper.failed_tasks | 255 | failedtasks = self.helper.failed_tasks |
| 252 | runningpids = self.helper.running_pids | 256 | runningpids = self.helper.running_pids |
| 253 | currenttime = time.time() | 257 | currenttime = time.time() |
| 254 | if not self.lasttime or (currenttime - self.lasttime > 5): | 258 | deltatime = currenttime - self.lasttime |
| 259 | |||
| 260 | if (deltatime > 5.0): | ||
| 255 | self.helper.needUpdate = True | 261 | self.helper.needUpdate = True |
| 256 | self.lasttime = currenttime | 262 | need_update = self.helper.needUpdate |
| 257 | if self.footer_present and not self.helper.needUpdate: | 263 | else: |
| 264 | # Do not let to update faster then _DEFAULT_PRINT_INTERVAL | ||
| 265 | # to avoid heavy print() flooding. | ||
| 266 | need_update = self.helper.needUpdate and (deltatime > self._DEFAULT_PRINT_INTERVAL) | ||
| 267 | |||
| 268 | if self.footer_present and (not need_update): | ||
| 269 | # Footer update is not need. | ||
| 258 | return | 270 | return |
| 271 | else: | ||
| 272 | # Footer update is need and store its "lasttime" value. | ||
| 273 | self.lasttime = currenttime | ||
| 274 | |||
| 259 | self.helper.needUpdate = False | 275 | self.helper.needUpdate = False |
| 260 | if (not self.helper.tasknumber_total or self.helper.tasknumber_current == self.helper.tasknumber_total) and not len(activetasks): | 276 | if (not self.helper.tasknumber_total or self.helper.tasknumber_current == self.helper.tasknumber_total) and not len(activetasks): |
| 261 | self.clearFooter() | 277 | self.clearFooter() |
