mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
685ef4e604
commit
96c07fefa9
|
@ -149,14 +149,17 @@ class Profile:
|
||||||
}
|
}
|
||||||
|
|
||||||
if not timer:
|
if not timer:
|
||||||
if hasattr(os, 'times'):
|
if os.name == 'mac':
|
||||||
self.timer = os.times
|
|
||||||
self.dispatcher = self.trace_dispatch
|
|
||||||
elif os.name == 'mac':
|
|
||||||
import MacOS
|
import MacOS
|
||||||
self.timer = MacOS.GetTicks
|
self.timer = MacOS.GetTicks
|
||||||
self.dispatcher = self.trace_dispatch_mac
|
self.dispatcher = self.trace_dispatch_mac
|
||||||
self.get_time = self.get_time_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:
|
else:
|
||||||
self.timer = time.time
|
self.timer = time.time
|
||||||
self.dispatcher = self.trace_dispatch_i
|
self.dispatcher = self.trace_dispatch_i
|
||||||
|
|
Loading…
Reference in New Issue