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
02be5753
Commit
02be5753
authored
Nov 04, 2017
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce some overhead in tracing code by avoiding to look up the thread state repeatedly.
parent
e9dbd6df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
Cython/Utility/Profile.c
Cython/Utility/Profile.c
+7
-6
No files found.
Cython/Utility/Profile.c
View file @
02be5753
/////////////// Profile.proto ///////////////
//@requires: Exceptions.c::PyErrFetchRestore
//@substitute: naming
// Note that cPython ignores PyTrace_EXCEPTION,
...
...
@@ -110,7 +111,7 @@
static
void
__Pyx_call_return_trace_func
(
PyThreadState
*
tstate
,
PyFrameObject
*
frame
,
PyObject
*
result
)
{
PyObject
*
type
,
*
value
,
*
traceback
;
PyErr_Fetch
(
&
type
,
&
value
,
&
traceback
);
__Pyx_ErrFetchInState
(
tstate
,
&
type
,
&
value
,
&
traceback
);
tstate
->
tracing
++
;
tstate
->
use_tracing
=
0
;
if
(
CYTHON_TRACE
&&
tstate
->
c_tracefunc
)
...
...
@@ -120,7 +121,7 @@
CYTHON_FRAME_DEL
(
frame
);
tstate
->
use_tracing
=
1
;
tstate
->
tracing
--
;
PyErr_Restore
(
type
,
value
,
traceback
);
__Pyx_ErrRestoreInState
(
tstate
,
type
,
value
,
traceback
);
}
#ifdef WITH_THREAD
...
...
@@ -172,7 +173,7 @@
static
int
__Pyx_call_line_trace_func
(
PyThreadState
*
tstate
,
PyFrameObject
*
frame
,
int
lineno
)
{
int
ret
;
PyObject
*
type
,
*
value
,
*
traceback
;
PyErr_Fetch
(
&
type
,
&
value
,
&
traceback
);
__Pyx_ErrFetchInState
(
tstate
,
&
type
,
&
value
,
&
traceback
);
__Pyx_PyFrame_SetLineNumber
(
frame
,
lineno
);
tstate
->
tracing
++
;
tstate
->
use_tracing
=
0
;
...
...
@@ -180,7 +181,7 @@
tstate
->
use_tracing
=
1
;
tstate
->
tracing
--
;
if
(
likely
(
!
ret
))
{
PyErr_Restore
(
type
,
value
,
traceback
);
__Pyx_ErrRestoreInState
(
tstate
,
type
,
value
,
traceback
);
}
else
{
Py_XDECREF
(
type
);
Py_XDECREF
(
value
);
...
...
@@ -266,7 +267,7 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
retval
=
1
;
tstate
->
tracing
++
;
tstate
->
use_tracing
=
0
;
PyErr_Fetch
(
&
type
,
&
value
,
&
traceback
);
__Pyx_ErrFetchInState
(
tstate
,
&
type
,
&
value
,
&
traceback
);
#if CYTHON_TRACE
if
(
tstate
->
c_tracefunc
)
retval
=
tstate
->
c_tracefunc
(
tstate
->
c_traceobj
,
*
frame
,
PyTrace_CALL
,
NULL
)
==
0
;
...
...
@@ -277,7 +278,7 @@ static int __Pyx_TraceSetupAndCall(PyCodeObject** code,
(
CYTHON_TRACE
&&
tstate
->
c_tracefunc
));
tstate
->
tracing
--
;
if
(
retval
)
{
PyErr_Restore
(
type
,
value
,
traceback
);
__Pyx_ErrRestoreInState
(
tstate
,
type
,
value
,
traceback
);
return
tstate
->
use_tracing
&&
retval
;
}
else
{
Py_XDECREF
(
type
);
...
...
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