Rev 3699: (jam) Update the timing function for --profile-imports on windows in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Sep 10 18:49:15 BST 2008


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3699
revision-id: pqm at pqm.ubuntu.com-20080910174908-pw8t6kbawoxc8rru
parent: pqm at pqm.ubuntu.com-20080910053334-fy7gihd6da2nyhy2
parent: john at arbash-meinel.com-20080909150912-wyttm8he1zsls2ck
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2008-09-10 18:49:08 +0100
message:
  (jam) Update the timing function for --profile-imports on windows
modified:
  profile_imports.py             profile_imports.py-20060618020306-k5uw80achysrokj9-1
    ------------------------------------------------------------
    revno: 3696.1.1
    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
    modified:
      profile_imports.py             profile_imports.py-20060618020306-k5uw80achysrokj9-1
=== 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