knotty/uihelper: use monotonic time to report task duration
PATCH 1/1 knotty/uihelper: use monotonic time to report task duration
From: Michael Opdenacker <[email protected]>
Without this, if the host machine is suspended to RAM, BitBake reports a task duration which includes the time the system remained suspended, not actually running the task.
This is addressed by getting the time from a monotonic clock, which ignores time elapsed during suspend.
This fixes [YOCTO 15015]
---
Note that while a successful build was obtained with this change, it might have side effects in places I didn't foresee (in logs?).
--- lib/bb/ui/knotty.py | 2 +- lib/bb/ui/uihelper.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
lib/bb/ui/knotty.py +1 -1
@@ -239,7 +239,7 @@ class TerminalFilter(object): activetasks = self.helper.running_tasks failedtasks = self.helper.failed_tasks runningpids = self.helper.running_pids - currenttime = time.time() + currenttime = time.monotonic() if not self.lasttime or (currenttime - self.lasttime > 5): self.helper.needUpdate = True self.lasttime = currenttime
lib/bb/ui/uihelper.py +2 -2
@@ -32,9 +32,9 @@ class BBUIHelper: if isinstance(event, bb.build.TaskStarted): tid = event._fn + ":" + event._task if event._mc != "default": - self.running_tasks[tid] = { 'title' : "mc:%s:%s %s" % (event._mc, event._package, event._task), 'starttime' : time.time(), 'pid' : event.pid } + self.running_tasks[tid] = { 'title' : "mc:%s:%s %s" % (event._mc, event._package, event._task), 'starttime' : time.monotonic(), 'pid' : event.pid } else: - self.running_tasks[tid] = { 'title' : "%s %s" % (event._package, event._task), 'starttime' : time.time(), 'pid' : event.pid } + self.running_tasks[tid] = { 'title' : "%s %s" % (event._package, event._task), 'starttime' : time.monotonic(), 'pid' : event.pid } self.running_pids.append(tid) self.pidmap[event.pid] = tid self.needUpdate = True
Signature · 1 line
2.37.2
Quoted 9 lines · Michael Opdenacker via lists.openembedded.org
From: Michael Opdenacker <[email protected]>
Without this, if the host machine is suspended to RAM, BitBake reports a task duration which includes the time the system remained suspended, not actually running the task.
This is addressed by getting the time from a monotonic clock, which ignores time elapsed during suspend.
Quoted 8 lines
This fixes [YOCTO 15015]
Signed-off-by Michael Opdenacker <[email protected]>---
Note that while a successful build was obtained with this change, it might have side effects in places I didn't foresee (in logs?).
There was some discussion about this in the bugzilla entry. I'm worried that two different concepts of time inside bitbake is going to end up causing a lot of confusion for what is a relatively minor issue. As such I'd prefer not to do this.
Cheers,
Richard