diff piecrust/commands/builtin/baking.py @ 804:08e6484a2600

bake: Show bake stats in descending order of time.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 12 Oct 2016 21:01:42 -0700
parents 87df68be4cc8
children 4850f8c21b6e
line wrap: on
line diff
--- a/piecrust/commands/builtin/baking.py	Thu Sep 29 21:59:20 2016 -0700
+++ b/piecrust/commands/builtin/baking.py	Wed Oct 12 21:01:42 2016 -0700
@@ -135,8 +135,9 @@
         s = stats[name]
 
         logger.info('  Timers:')
-        for name in sorted(s.timers.keys()):
-            val_str = '%8.1f s' % s.timers[name]
+        for name, val in sorted(s.timers.items(), key=lambda i: i[1],
+                                reverse=True):
+            val_str = '%8.1f s' % val
             logger.info(
                     "%s[%s%s%s] %s" %
                     (indent, Fore.GREEN, val_str, Fore.RESET, name))