Commit bf980e0d authored by Robert Bradshaw's avatar Robert Bradshaw

Profile method call tests.

parent a961ab0c
...@@ -42,6 +42,18 @@ __doc__ = u""" ...@@ -42,6 +42,18 @@ __doc__ = u"""
... ...
KeyError: 'nogil_noprof' KeyError: 'nogil_noprof'
>>> short_stats['f_raise']
100
>>> short_stats['m_def']
200
>>> short_stats['m_cdef']
100
>>> short_stats['m_cpdef']
200
>>> short_stats['m_cpdef (wrapper)']
100
>>> try: >>> try:
... os.unlink(statsfile) ... os.unlink(statsfile)
... except: ... except:
...@@ -52,6 +64,7 @@ cimport cython ...@@ -52,6 +64,7 @@ cimport cython
def test_profile(long N): def test_profile(long N):
cdef long i, n = 0 cdef long i, n = 0
cdef A a = A()
for i from 0 <= i < N: for i from 0 <= i < N:
n += f_def(i) n += f_def(i)
n += f_cdef(i) n += f_cdef(i)
...@@ -64,6 +77,11 @@ def test_profile(long N): ...@@ -64,6 +77,11 @@ def test_profile(long N):
n += nogil_prof(i) n += nogil_prof(i)
n += withgil_noprof(i) n += withgil_noprof(i)
n += withgil_prof(i) n += withgil_prof(i)
n += a.m_def(i)
n += (<object>a).m_def(i)
n += a.m_cpdef(i)
n += (<object>a).m_cpdef(i)
n += a.m_cdef(i)
try: try:
n += f_raise(i+2) n += f_raise(i+2)
except RuntimeError: except RuntimeError:
...@@ -107,3 +125,10 @@ cdef int nogil_noprof(long a) nogil: ...@@ -107,3 +125,10 @@ cdef int nogil_noprof(long a) nogil:
cdef int nogil_prof(long a) nogil: cdef int nogil_prof(long a) nogil:
return a return a
cdef class A(object):
def m_def(self, long a):
return a
cpdef m_cpdef(self, long a):
return a
cdef m_cdef(self, long a):
return a
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment