summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-03-17 14:46:43 (GMT)
committerGuido van Rossum <guido@python.org>1998-03-17 14:46:43 (GMT)
commit96c07fefa94f01042aeeb32951305e91676dfe8f (patch)
tree9365679c69487fb89295faf50440a65d714400ce
parent685ef4e604be84aa40c1b3886726dcac405b1d33 (diff)
downloadcpython-96c07fefa94f01042aeeb32951305e91676dfe8f.zip
cpython-96c07fefa94f01042aeeb32951305e91676dfe8f.tar.gz
cpython-96c07fefa94f01042aeeb32951305e91676dfe8f.tar.bz2
Prefer clock() over times() for timer function, except on the Mac,
where we use GetTicks() -- its clock() is a crock, with only 1 second accuracy, I believe.
-rwxr-xr-xLib/profile.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/profile.py b/Lib/profile.py
index ae5182a..f7de6a4 100755
--- a/Lib/profile.py
+++ b/Lib/profile.py
@@ -149,14 +149,17 @@ class Profile:
}
if not timer:
- if hasattr(os, 'times'):
- self.timer = os.times
- self.dispatcher = self.trace_dispatch
- elif os.name == 'mac':
+ if os.name == 'mac':
import MacOS
self.timer = MacOS.GetTicks
self.dispatcher = self.trace_dispatch_mac
self.get_time = self.get_time_mac
+ elif hasattr(time, 'clock'):
+ self.timer = time.clock
+ self.dispatcher = self.trace_dispatch_i
+ elif hasattr(os, 'times'):
+ self.timer = os.times
+ self.dispatcher = self.trace_dispatch
else:
self.timer = time.time
self.dispatcher = self.trace_dispatch_i