mirror of
https://git.yoctoproject.org/poky
synced 2026-06-03 01:40:07 +00:00
bitbake: knotty: Pretty print task elapsed time
A task's runtime is currently printed in seconds. Change it to include minutes and hours for easier reading. (Bitbake rev: c593ae5ec9fecd4bde823948024e4d56314a60ce) Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
34d526a79b
commit
be75acf17f
@@ -222,6 +222,18 @@ class TerminalFilter(object):
|
|||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
self.footer_present = False
|
self.footer_present = False
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
def updateFooter(self):
|
def updateFooter(self):
|
||||||
if not self.cuu:
|
if not self.cuu:
|
||||||
return
|
return
|
||||||
@@ -258,7 +270,7 @@ class TerminalFilter(object):
|
|||||||
else:
|
else:
|
||||||
start_time = activetasks[t].get("starttime", None)
|
start_time = activetasks[t].get("starttime", None)
|
||||||
if start_time:
|
if start_time:
|
||||||
tasks.append("%s - %ds (pid %s)" % (activetasks[t]["title"], currenttime - start_time, t))
|
tasks.append("%s - %s (pid %s)" % (activetasks[t]["title"], self.elapsed(currenttime - start_time), t))
|
||||||
else:
|
else:
|
||||||
tasks.append("%s (pid %s)" % (activetasks[t]["title"], t))
|
tasks.append("%s (pid %s)" % (activetasks[t]["title"], t))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user