diff piecrust/main.py @ 989:8adc27285d93

bake: Big pass on bake performance. - Reduce the amount of data passed between processes. - Make inter-process data simple objects to make it easier to test with alternatives to pickle. - Make sources have the basic requirement to be able to find a content item from an item spec (path). - Make Hoedown the default Markdown formatter.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 19 Nov 2017 14:29:17 -0800
parents 45ad976712ec
children c4cfbbeed72e
line wrap: on
line diff
--- a/piecrust/main.py	Fri Nov 03 23:14:56 2017 -0700
+++ b/piecrust/main.py	Sun Nov 19 14:29:17 2017 -0800
@@ -19,6 +19,8 @@
 
 logger = logging.getLogger(__name__)
 
+_chef_start_time = time.perf_counter()
+
 
 class ColoredFormatter(logging.Formatter):
     COLORS = {
@@ -246,7 +248,6 @@
 
 def _run_chef(pre_args, argv):
     # Setup the app.
-    start_time = time.perf_counter()
     root = None
     if pre_args.root:
         root = os.path.expanduser(pre_args.root)
@@ -306,7 +307,7 @@
 
     # Parse the command line.
     result = parser.parse_args(argv)
-    logger.debug(format_timed(start_time, 'initialized PieCrust',
+    logger.debug(format_timed(_chef_start_time, 'initialized PieCrust',
                               colored=False))
 
     # Print the help if no command was specified.
@@ -314,6 +315,10 @@
         parser.print_help()
         return 0
 
+    # Add some timing information.
+    app.env.stats.registerTimer('ChefStartup')
+    app.env.stats.stepTimerSince('ChefStartup', _chef_start_time)
+
     # Run the command!
     ctx = CommandContext(appfactory, app, parser, result)
     exit_code = result.func(ctx)