Message ID | 20230125084725.2262388-1-michael.opdenacker@bootlin.com |
---|---|
State | New |
Headers | show |
Series | knotty/uihelper: use monotonic time to report task duration | expand |
On Wed, 2023-01-25 at 09:47 +0100, Michael Opdenacker via lists.openembedded.org wrote: > From: Michael Opdenacker <michael.opdenacker@bootlin.com> > > 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] > > Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> > > --- > > 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
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py index 431baa15..3174d977 100644 --- a/lib/bb/ui/knotty.py +++ b/lib/bb/ui/knotty.py @@ -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 diff --git a/lib/bb/ui/uihelper.py b/lib/bb/ui/uihelper.py index 82913e0d..5524f8d6 100644 --- a/lib/bb/ui/uihelper.py +++ b/lib/bb/ui/uihelper.py @@ -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