diff piecrust/processing/worker.py @ 421:4a43d7015b75

bake: Improve performance timers reports. Add timers per-worker, and separate bake and pipeline workers.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 20 Jun 2015 23:27:39 -0700
parents c4b3a7fd2f87
children 5ceb86818dc5
line wrap: on
line diff
--- a/piecrust/processing/worker.py	Sat Jun 20 23:27:04 2015 -0700
+++ b/piecrust/processing/worker.py	Sat Jun 20 23:27:39 2015 -0700
@@ -73,7 +73,8 @@
         # Create the app local to this worker.
         app = PieCrust(self.ctx.root_dir, debug=self.ctx.debug)
         app.env.fs_cache_only_for_main_page = True
-        app.env.registerTimer("Worker_%d" % self.wid)
+        app.env.registerTimer("PipelineWorker_%d_Total" % self.wid)
+        app.env.registerTimer("PipelineWorkerInit")
         app.env.registerTimer("JobReceive")
         app.env.registerTimer('BuildProcessingTree')
         app.env.registerTimer('RunProcessingTree')
@@ -102,6 +103,8 @@
         # patching the processors with some new ones.
         processors.sort(key=lambda p: p.priority)
 
+        app.env.stepTimerSince("PipelineWorkerInit", work_start_time)
+
         aborted_with_exception = None
         while not self.ctx.abort_event.is_set():
             try:
@@ -131,8 +134,8 @@
         for proc in processors:
             proc.onPipelineEnd(pipeline_ctx)
 
-        app.env.stepTimer("Worker_%d" % self.wid,
-                          time.perf_counter() - work_start_time)
+        app.env.stepTimerSince("PipelineWorker_%d_Total" % self.wid,
+                               work_start_time)
         self.ctx.results.put_nowait({
                 'type': 'timers', 'data': app.env._timers})