[Zope3-checkins] SVN: Zope3/trunk/src/zope/testbrowser/browser.py
make zope.testbrowser's timing use wall time on linux,
it was (insanely) using
Benji York
benji at zope.com
Fri Mar 24 17:04:36 EST 2006
Log message for revision 66155:
make zope.testbrowser's timing use wall time on linux, it was (insanely) using
CPU time
Changed:
U Zope3/trunk/src/zope/testbrowser/browser.py
-=-
Modified: Zope3/trunk/src/zope/testbrowser/browser.py
===================================================================
--- Zope3/trunk/src/zope/testbrowser/browser.py 2006-03-24 16:11:01 UTC (rev 66154)
+++ Zope3/trunk/src/zope/testbrowser/browser.py 2006-03-24 22:04:36 UTC (rev 66155)
@@ -104,14 +104,22 @@
self._pystones_per_second = pystone.pystones(pystone.LOOPS/10)[1]
return self._pystones_per_second
+ def _getTime(self):
+ if sys.platform.startswith('win'):
+ # Windows' time.clock gives us high-resolution wall-time
+ return time.clock()
+ else:
+ # everyone else uses time.time
+ return time.time()
+
def start(self):
"""Begin a timing period"""
- self.start_time = time.clock()
+ self.start_time = self._getTime()
self.end_time = None
def stop(self):
"""End a timing period"""
- self.end_time = time.clock()
+ self.end_time = self._getTime()
@property
def elapsedSeconds(self):
@@ -121,7 +129,7 @@
the end is the current time.
"""
if self.end_time is None:
- end_time = time.clock()
+ end_time = self._getTime()
else:
end_time = self.end_time
return end_time - self.start_time
More information about the Zope3-Checkins
mailing list