Rev 3697: Use the right timing function on win32 in http://bzr.arbash-meinel.com/branches/bzr/jam-integration
John Arbash Meinel
john at arbash-meinel.com
Tue Sep 9 16:10:07 BST 2008
At http://bzr.arbash-meinel.com/branches/bzr/jam-integration
------------------------------------------------------------
revno: 3697
revision-id: john at arbash-meinel.com-20080909150912-wyttm8he1zsls2ck
parent: pqm at pqm.ubuntu.com-20080908061835-nz7hj7o0pms1nf9p
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: jam-integration
timestamp: Tue 2008-09-09 10:09:12 -0500
message:
Use the right timing function on win32
-------------- next part --------------
=== modified file 'profile_imports.py'
--- a/profile_imports.py 2006-10-11 00:23:23 +0000
+++ b/profile_imports.py 2008-09-09 15:09:12 +0000
@@ -26,6 +26,9 @@
_total_stack = {}
_info = {}
_cur_id = 0
+_timer = time.time
+if sys.platform == 'win32':
+ _timer = time.clock
def stack_add(name, frame_name, frame_lineno, scope_name=None):
@@ -131,12 +134,12 @@
this = stack_add(extra + name, frame_name, frame_lineno, scope_name)
- tstart = time.time()
+ tstart = _timer()
try:
# Do the import
mod = _real_import(name, globals, locals, fromlist)
finally:
- tload = time.time()-tstart
+ tload = _timer()-tstart
stack_finish(this, tload)
return mod
@@ -160,12 +163,12 @@
frame_lineno = frame.f_lineno
this = stack_add(extra+repr(args[0]), frame_name, frame_lineno)
- tstart = time.time()
+ tstart = _timer()
try:
# Measure the compile time
comp = _real_compile(*args, **kwargs)
finally:
- tcompile = time.time() - tstart
+ tcompile = _timer() - tstart
stack_finish(this, tcompile)
return comp
More information about the bazaar-commits
mailing list