diff piecrust/processing/pipeline.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 9a92e2804562
line wrap: on
line diff
--- a/piecrust/processing/pipeline.py	Sun Mar 13 16:55:12 2016 -0700
+++ b/piecrust/processing/pipeline.py	Mon Mar 14 08:26:14 2016 -0700
@@ -6,6 +6,7 @@
 import logging
 import multiprocessing
 from piecrust.chefutil import format_timed, format_timed_scope
+from piecrust.environment import ExecutionStats
 from piecrust.processing.base import PipelineContext
 from piecrust.processing.records import (
         ProcessorPipelineRecordEntry, TransitionalProcessorPipelineRecord,
@@ -54,7 +55,6 @@
         ignores = baker_params.get('ignore', [])
         ignores += [
                 '_cache', '_counter',
-                'theme_info.yml',
                 '.DS_Store', 'Thumbs.db',
                 '.git*', '.hg*', '.svn']
         self.ignore_patterns = make_re(ignores)
@@ -148,18 +148,14 @@
 
         # Shutdown the workers and get timing information from them.
         reports = pool.close()
-        record.current.timers = {}
+        total_stats = ExecutionStats()
+        record.current.stats['_Total'] = total_stats
         for i in range(len(reports)):
-            timers = reports[i]
-            if timers is None:
-                continue
-
-            worker_name = 'PipelineWorker_%d' % i
-            record.current.timers[worker_name] = {}
-            for name, val in timers['data'].items():
-                main_val = record.current.timers.setdefault(name, 0)
-                record.current.timers[name] = main_val + val
-                record.current.timers[worker_name][name] = val
+            worker_stats = reports[i]['data']
+            if worker_stats is not None:
+                worker_name = 'PipelineWorker_%d' % i
+                record.current.stats[worker_name] = worker_stats
+                total_stats.mergeStats(worker_stats)
 
         # Invoke post-processors.
         pipeline_ctx.record = record.current