[pypy-svn] pypy jit-lsprofile: (fijal, alex): make _lsprof use the new timer.
alex_gaynor
commits-noreply at bitbucket.org
Sun Mar 13 21:24:27 CET 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: jit-lsprofile
Changeset: r42575:3bb134ca6f6d
Date: 2011-03-13 16:24 -0400
http://bitbucket.org/pypy/pypy/changeset/3bb134ca6f6d/
Log: (fijal, alex): make _lsprof use the new timer.
diff --git a/pypy/module/_lsprof/interp_lsprof.py b/pypy/module/_lsprof/interp_lsprof.py
--- a/pypy/module/_lsprof/interp_lsprof.py
+++ b/pypy/module/_lsprof/interp_lsprof.py
@@ -7,6 +7,7 @@
from pypy.interpreter.typedef import (TypeDef, GetSetProperty,
interp_attrproperty)
from pypy.rlib import jit
+from pypy.rlib.rtimer import read_timestamp
from pypy.rpython.lltypesystem import rffi
import time, sys
@@ -229,7 +230,7 @@
e.write_unraisable(space, "timer function ",
self.w_callable)
return 0.0
- return read_timestamp_double()
+ return float(read_timestamp())
def enable(self, space, w_subcalls=NoneNotWrapped,
w_builtins=NoneNotWrapped):
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
@@ -91,6 +91,19 @@
assert spam2bar.inlinetime == 1.0
assert spam2bar.totaltime == 1.0
+ def test_direct_read_timestamp(self):
+ import _lsprof
+
+ def f():
+ pass
+
+ profiler = _lsprof.Profiler()
+ profiler.enable()
+ f()
+ profiler.disable()
+ stats = profiler.getstats()
+ xxx
+
def test_cprofile(self):
import sys, os
# XXX this is evil trickery to walk around the fact that we don't
More information about the Pypy-commit
mailing list