Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
bf980e0d
Commit
bf980e0d
authored
Mar 25, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Profile method call tests.
parent
a961ab0c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
tests/run/pstats_profile_test.pyx
tests/run/pstats_profile_test.pyx
+25
-0
No files found.
tests/run/pstats_profile_test.pyx
View file @
bf980e0d
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment