diff piecrust/baking/worker.py @ 687:61d606fbc313

bake: Change `show-timers` to `show-stats`, add stats.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 14 Mar 2016 08:26:14 -0700
parents 81d9c3a3a0b5
children f7207f4dab82
line wrap: on
line diff
--- a/piecrust/baking/worker.py	Sun Mar 13 16:55:12 2016 -0700
+++ b/piecrust/baking/worker.py	Mon Mar 14 08:26:14 2016 -0700
@@ -41,6 +41,9 @@
         app.env.registerTimer("BakeWorker_%d_Total" % self.wid)
         app.env.registerTimer("BakeWorkerInit")
         app.env.registerTimer("JobReceive")
+        app.env.registerManifest("LoadJobs")
+        app.env.registerManifest("RenderJobs")
+        app.env.registerManifest("BakeJobs")
         self.ctx.app = app
 
         # Load previous record
@@ -71,9 +74,10 @@
     def getReport(self):
         self.ctx.app.env.stepTimerSince("BakeWorker_%d_Total" % self.wid,
                                         self.work_start_time)
+        data = self.ctx.app.env.getStats()
         return {
-                'type': 'timers',
-                'data': self.ctx.app.env._timers}
+                'type': 'stats',
+                'data': data}
 
 
 JOB_LOAD, JOB_RENDER_FIRST, JOB_BAKE = range(0, 3)
@@ -116,6 +120,7 @@
         # Just make sure the page has been cached.
         fac = load_factory(self.app, job)
         logger.debug("Loading page: %s" % fac.ref_spec)
+        self.app.env.addManifestEntry('LoadJobs', fac.ref_spec)
         result = {
                 'source_name': fac.source.name,
                 'path': fac.path,
@@ -137,6 +142,7 @@
     def handleJob(self, job):
         # Render the segments for the first sub-page of this page.
         fac = load_factory(self.app, job)
+        self.app.env.addManifestEntry('RenderJobs', fac.ref_spec)
 
         # These things should be OK as they're checked upstream by the baker.
         route = self.app.getRoute(fac.source.name, fac.metadata,
@@ -177,6 +183,7 @@
     def handleJob(self, job):
         # Actually bake the page and all its sub-pages to the output folder.
         fac = load_factory(self.app, job['factory_info'])
+        self.app.env.addManifestEntry('BakeJobs', fac.ref_spec)
 
         route_metadata = job['route_metadata']
         tax_info = job['taxonomy_info']