[pypy-svn] pypy jit-lsprofile: Ah, we need to have a busy wait here to make sure timer.h

arigo commits-noreply at bitbucket.org
Wed Jan 5 18:21:25 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: jit-lsprofile
Changeset: r40410:7cb0af3aae1b
Date: 2011-01-05 18:21 +0100
http://bitbucket.org/pypy/pypy/changeset/7cb0af3aae1b/

Log:	Ah, we need to have a busy wait here to make sure timer.h returns
	valid values.

diff --git a/pypy/module/_lsprof/test/test_cprofile.py b/pypy/module/_lsprof/test/test_cprofile.py
--- a/pypy/module/_lsprof/test/test_cprofile.py
+++ b/pypy/module/_lsprof/test/test_cprofile.py
@@ -5,7 +5,9 @@
     from pypy.module._lsprof.interp_lsprof import read_timestamp_double
     import time
     t1 = read_timestamp_double()
-    time.sleep(1)
+    start = time.time()
+    while time.time() - start < 1.0:
+        pass     # busy wait
     t2 = read_timestamp_double()
     assert 0.9 < t2 - t1 < 1.9
 


More information about the Pypy-commit mailing list