diff options
author | Jacob Kroon <jacob.kroon@gmail.com> | 2019-04-26 23:37:27 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-04-30 12:04:04 +0100 |
commit | c593ae5ec9fecd4bde823948024e4d56314a60ce (patch) | |
tree | a1f6ead58fc0e971f4e5b0257043962d313ae216 /lib/bb/ui/knotty.py | |
parent | cf11fdb30c405e1a4521a7299f84816c0e13a881 (diff) | |
download | bitbake-c593ae5ec9fecd4bde823948024e4d56314a60ce.tar.gz |
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.
Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/ui/knotty.py')
-rw-r--r-- | lib/bb/ui/knotty.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py index fa88e6ccd..f362c23af 100644 --- a/lib/bb/ui/knotty.py +++ b/lib/bb/ui/knotty.py @@ -222,6 +222,18 @@ class TerminalFilter(object): sys.stdout.flush() 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): if not self.cuu: return @@ -258,7 +270,7 @@ class TerminalFilter(object): else: start_time = activetasks[t].get("starttime", None) 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: tasks.append("%s (pid %s)" % (activetasks[t]["title"], t)) |