changeset 417:eef887cec776

internal: Add utility function for incrementing performance timers.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 20 Jun 2015 23:23:51 -0700
parents ff6cc43fb40c
children d5724c0c8f1a
files piecrust/environment.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/environment.py	Sat Jun 20 21:05:25 2015 -0700
+++ b/piecrust/environment.py	Sat Jun 20 23:23:51 2015 -0700
@@ -83,6 +83,9 @@
     def stepTimer(self, category, value):
         self._timers[category] += value
 
+    def stepTimerSince(self, category, since):
+        self.stepTimer(category, time.perf_counter() - since)
+
     def _onSubCacheDirChanged(self, app):
         for name, repo in self.fs_caches.items():
             cache = app.cache.getCache(name)