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
a6e074f7
Commit
a6e074f7
authored
Sep 25, 2009
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turn of profiling by default, rename macro.
parent
b22b91af
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
24 deletions
+21
-24
Cython/Compiler/Nodes.py
Cython/Compiler/Nodes.py
+15
-18
Cython/Compiler/Options.py
Cython/Compiler/Options.py
+2
-2
tests/bugs.txt
tests/bugs.txt
+1
-1
tests/run/profile_test.pyx
tests/run/profile_test.pyx
+3
-3
No files found.
Cython/Compiler/Nodes.py
View file @
a6e074f7
...
@@ -1062,14 +1062,11 @@ class FuncDefNode(StatNode, BlockNode):
...
@@ -1062,14 +1062,11 @@ class FuncDefNode(StatNode, BlockNode):
is_getbuffer_slot
=
(
self
.
entry
.
name
==
"__getbuffer__"
and
is_getbuffer_slot
=
(
self
.
entry
.
name
==
"__getbuffer__"
and
self
.
entry
.
scope
.
is_c_class_scope
)
self
.
entry
.
scope
.
is_c_class_scope
)
if
code
.
globalstate
.
directives
[
'profile'
]
is
None
:
profile
=
'inline'
not
in
self
.
modifiers
and
not
lenv
.
nogil
else
:
profile
=
code
.
globalstate
.
directives
[
'profile'
]
profile
=
code
.
globalstate
.
directives
[
'profile'
]
if
profile
and
lenv
.
nogil
:
error
(
self
.
pos
,
"Cannot profile nogil function."
)
if
profile
:
if
profile
:
code
.
globalstate
.
use_utility_code
(
trace_utility_code
)
if
lenv
.
nogil
:
error
(
self
.
pos
,
"Cannot profile nogil function."
)
code
.
globalstate
.
use_utility_code
(
profile_utility_code
)
# Generate C code for header and body of function
# Generate C code for header and body of function
code
.
enter_cfunc_scope
()
code
.
enter_cfunc_scope
()
...
@@ -5791,22 +5788,22 @@ proto="""
...
@@ -5791,22 +5788,22 @@ proto="""
# Note that cPython ignores PyTrace_EXCEPTION,
# Note that cPython ignores PyTrace_EXCEPTION,
# but maybe some other profilers don't.
# but maybe some other profilers don't.
trac
e_utility_code
=
UtilityCode
(
proto
=
"""
profil
e_utility_code
=
UtilityCode
(
proto
=
"""
#ifndef CYTHON_
TRACING
#ifndef CYTHON_
PROFILE
#define CYTHON_
TRACING
1
#define CYTHON_
PROFILE
1
#endif
#endif
#ifndef CYTHON_
TRACING
_REUSE_FRAME
#ifndef CYTHON_
PROFILE
_REUSE_FRAME
#define CYTHON_
TRACING
_REUSE_FRAME 0
#define CYTHON_
PROFILE
_REUSE_FRAME 0
#endif
#endif
#if CYTHON_
TRACING
#if CYTHON_
PROFILE
#include "compile.h"
#include "compile.h"
#include "frameobject.h"
#include "frameobject.h"
#include "traceback.h"
#include "traceback.h"
#if CYTHON_
TRACING
_REUSE_FRAME
#if CYTHON_
PROFILE
_REUSE_FRAME
#define CYTHON_FRAME_MODIFIER static
#define CYTHON_FRAME_MODIFIER static
#define CYTHON_FRAME_DEL
#define CYTHON_FRAME_DEL
#else
#else
...
@@ -5846,7 +5843,7 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, c
...
@@ -5846,7 +5843,7 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, c
#define __Pyx_TraceCall(funcname, srcfile, firstlineno)
#define __Pyx_TraceCall(funcname, srcfile, firstlineno)
#define __Pyx_TraceException()
#define __Pyx_TraceException()
#define __Pyx_TraceReturn(result)
#define __Pyx_TraceReturn(result)
#endif /* CYTHON_
TRACING
*/
#endif /* CYTHON_
PROFILE
*/
"""
"""
%
{
%
{
"FRAME"
:
Naming
.
frame_cname
,
"FRAME"
:
Naming
.
frame_cname
,
...
@@ -5854,14 +5851,14 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, c
...
@@ -5854,14 +5851,14 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code, PyFrameObject** frame, c
},
},
impl
=
"""
impl
=
"""
#if CYTHON_
TRACING
#if CYTHON_
PROFILE
static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
PyFrameObject** frame,
PyFrameObject** frame,
const char *funcname,
const char *funcname,
const char *srcfile,
const char *srcfile,
int firstlineno) {
int firstlineno) {
if (*frame == NULL || !CYTHON_
TRACING
_REUSE_FRAME) {
if (*frame == NULL || !CYTHON_
PROFILE
_REUSE_FRAME) {
if (*code == NULL) {
if (*code == NULL) {
*code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
*code = __Pyx_createFrameCodeObject(funcname, srcfile, firstlineno);
if (*code == NULL) return 0;
if (*code == NULL) return 0;
...
@@ -5921,7 +5918,7 @@ bad:
...
@@ -5921,7 +5918,7 @@ bad:
return py_code;
return py_code;
}
}
#endif /* CYTHON_
TRACING
*/
#endif /* CYTHON_
PROFILE
*/
"""
%
{
"""
%
{
'EMPTY_TUPLE'
:
Naming
.
empty_tuple
,
'EMPTY_TUPLE'
:
Naming
.
empty_tuple
,
'EMPTY_BYTES'
:
Naming
.
empty_bytes
,
'EMPTY_BYTES'
:
Naming
.
empty_bytes
,
...
...
Cython/Compiler/Options.py
View file @
a6e074f7
...
@@ -67,11 +67,11 @@ option_defaults = {
...
@@ -67,11 +67,11 @@ option_defaults = {
'wraparound'
:
True
,
'wraparound'
:
True
,
'c99_complex'
:
False
,
# Don't use macro wrappers for complex arith, not sure what to name this...
'c99_complex'
:
False
,
# Don't use macro wrappers for complex arith, not sure what to name this...
'callspec'
:
""
,
'callspec'
:
""
,
'profile'
:
Non
e
,
'profile'
:
Fals
e
,
}
}
# Override types possibilities above, if needed
# Override types possibilities above, if needed
option_types
=
{
'profile'
:
bool
}
option_types
=
{}
for
key
,
val
in
option_defaults
.
items
():
for
key
,
val
in
option_defaults
.
items
():
if
key
not
in
option_types
:
if
key
not
in
option_types
:
...
...
tests/bugs.txt
View file @
a6e074f7
...
@@ -13,4 +13,4 @@ bad_c_struct_T252
...
@@ -13,4 +13,4 @@ bad_c_struct_T252
missing_baseclass_in_predecl_T262
missing_baseclass_in_predecl_T262
# Not yet enabled
# Not yet enabled
profile_test
#
profile_test
tests/run/profile_test.pyx
View file @
a6e074f7
# cython: profile = True
__doc__
=
u"""
__doc__
=
u"""
>>> import os, tempfile, cProfile as profile, pstats
>>> import os, tempfile, cProfile as profile, pstats
>>> statsfile = tempfile.mkstemp()[1]
>>> statsfile = tempfile.mkstemp()[1]
...
@@ -9,9 +11,7 @@ __doc__ = u"""
...
@@ -9,9 +11,7 @@ __doc__ = u"""
>>> short_stats['f_cdef']
>>> short_stats['f_cdef']
100
100
>>> short_stats['f_inline']
>>> short_stats['f_inline']
Traceback (most recent call last):
100
...
KeyError: 'f_inline'
>>> short_stats['f_inline_prof']
>>> short_stats['f_inline_prof']
100
100
>>> short_stats['f_noprof']
>>> short_stats['f_noprof']
...
...
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