summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/knotty.py
diff options
context:
space:
mode:
authorJacob Kroon <jacob.kroon@gmail.com>2019-04-26 23:37:27 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-04-30 12:05:24 +0100
commitbe75acf17f851f161a679ad4cd73423dbb50db3d (patch)
treed6672f591e92b36ce78d294d9a72e9d0401e9336 /bitbake/lib/bb/ui/knotty.py
parent34d526a79be469fa88f21c37f8cd9fd905cdb49c (diff)
downloadpoky-be75acf17f851f161a679ad4cd73423dbb50db3d.tar.gz
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>
Diffstat (limited to 'bitbake/lib/bb/ui/knotty.py')
-rw-r--r--bitbake/lib/bb/ui/knotty.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py
index fa88e6ccdd..f362c23afc 100644
--- a/bitbake/lib/bb/ui/knotty.py
+++ b/bitbake/lib/bb/ui/knotty.py
@@ -222,6 +222,18 @@ class TerminalFilter(object):
222 sys.stdout.flush() 222 sys.stdout.flush()
223 self.footer_present = False 223 self.footer_present = False
224 224
225 def elapsed(self, sec):
226 hrs = int(sec / 3600.0)
227 sec -= hrs * 3600
228 min = int(sec / 60.0)
229 sec -= min * 60
230 if hrs > 0:
231 return "%dh%dm%ds" % (hrs, min, sec)
232 elif min > 0:
233 return "%dm%ds" % (min, sec)
234 else:
235 return "%ds" % (sec)
236
225 def updateFooter(self): 237 def updateFooter(self):
226 if not self.cuu: 238 if not self.cuu:
227 return 239 return
@@ -258,7 +270,7 @@ class TerminalFilter(object):
258 else: 270 else:
259 start_time = activetasks[t].get("starttime", None) 271 start_time = activetasks[t].get("starttime", None)
260 if start_time: 272 if start_time:
261 tasks.append("%s - %ds (pid %s)" % (activetasks[t]["title"], currenttime - start_time, t)) 273 tasks.append("%s - %s (pid %s)" % (activetasks[t]["title"], self.elapsed(currenttime - start_time), t))
262 else: 274 else:
263 tasks.append("%s (pid %s)" % (activetasks[t]["title"], t)) 275 tasks.append("%s (pid %s)" % (activetasks[t]["title"], t))
264 276