summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorNicholas Bastin <nick.bastin@gmail.com>2004-03-24 21:57:10 (GMT)
committerNicholas Bastin <nick.bastin@gmail.com>2004-03-24 21:57:10 (GMT)
commitc69ebe8d50529eae281275c841428eb9b375a442 (patch)
treeb8150da59983ca89c192b45311eeee050a0b4a16 /Doc
parenta1dde13389cf47ac626394796740925504e3e272 (diff)
downloadcpython-c69ebe8d50529eae281275c841428eb9b375a442.zip
cpython-c69ebe8d50529eae281275c841428eb9b375a442.tar.gz
cpython-c69ebe8d50529eae281275c841428eb9b375a442.tar.bz2
Enable the profiling of C functions (builtins and extensions)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/api/init.tex28
-rw-r--r--Doc/lib/libpdb.tex15
2 files changed, 37 insertions, 6 deletions
diff --git a/Doc/api/init.tex b/Doc/api/init.tex
index 2f21168..7949690 100644
--- a/Doc/api/init.tex
+++ b/Doc/api/init.tex
@@ -726,16 +726,21 @@ previous versions.
The first parameter is the object passed to the registration
function as \var{obj}, \var{frame} is the frame object to which the
event pertains, \var{what} is one of the constants
- \constant{PyTrace_CALL}, \constant{PyTrace_EXCEPT},
- \constant{PyTrace_LINE} or \constant{PyTrace_RETURN}, and \var{arg}
+ \constant{PyTrace_CALL}, \constant{PyTrace_EXCEPTION},
+ \constant{PyTrace_LINE}, \constant{PyTrace_RETURN},
+ \constant{PyTrace_C_CALL}, \constant{PyTrace_C_EXCEPTION},
+ or \constant{PyTrace_C_RETURN}, and \var{arg}
depends on the value of \var{what}:
\begin{tableii}{l|l}{constant}{Value of \var{what}}{Meaning of \var{arg}}
\lineii{PyTrace_CALL}{Always \NULL.}
- \lineii{PyTrace_EXCEPT}{Exception information as returned by
+ \lineii{PyTrace_EXCEPTION}{Exception information as returned by
\function{sys.exc_info()}.}
\lineii{PyTrace_LINE}{Always \NULL.}
\lineii{PyTrace_RETURN}{Value being returned to the caller.}
+ \lineii{PyTrace_C_CALL}{Name of function being called.}
+ \lineii{PyTrace_C_EXCEPTION}{Always \NULL.}
+ \lineii{PyTrace_C_RETURN}{Always \NULL.}
\end{tableii}
\end{ctypedesc}
@@ -747,7 +752,7 @@ previous versions.
control transfer to the Python bytecode in the corresponding frame.
\end{cvardesc}
-\begin{cvardesc}{int}{PyTrace_EXCEPT}
+\begin{cvardesc}{int}{PyTrace_EXCEPTION}
The value of the \var{what} parameter to a \ctype{Py_tracefunc}
function when an exception has been raised. The callback function
is called with this value for \var{what} when after any bytecode is
@@ -770,6 +775,21 @@ previous versions.
functions when a call is returning without propagating an exception.
\end{cvardesc}
+\begin{cvardesc}{int}{PyTrace_C_CALL}
+ The value for the \var{what} parameter to \ctype{Py_tracefunc}
+ functions when a C function is about to be called.
+\end{cvardesc}
+
+\begin{cvardesc}{int}{PyTrace_C_EXCEPTION}
+ The value for the \var{what} parameter to \ctype{Py_tracefunc}
+ functions when a C function has thrown an exception.
+\end{cvardesc}
+
+\begin{cvardesc}{int}{PyTrace_C_RETURN}
+ The value for the \var{what} parameter to \ctype{Py_tracefunc}
+ functions when a C function has returned.
+\end{cvardesc}
+
\begin{cfuncdesc}{void}{PyEval_SetProfile}{Py_tracefunc func, PyObject *obj}
Set the profiler function to \var{func}. The \var{obj} parameter is
passed to the function as its first parameter, and may be any Python
diff --git a/Doc/lib/libpdb.tex b/Doc/lib/libpdb.tex
index ee9ab91..2229dc8 100644
--- a/Doc/lib/libpdb.tex
+++ b/Doc/lib/libpdb.tex
@@ -350,8 +350,9 @@ Some changes were made to the interpreter:
Trace functions have three arguments: \var{frame}, \var{event}, and
\var{arg}. \var{frame} is the current stack frame. \var{event} is a
-string: \code{'call'}, \code{'line'}, \code{'return'} or
-\code{'exception'}. \var{arg} depends on the event type.
+string: \code{'call'}, \code{'line'}, \code{'return'}, \code{'exception'},
+ \code{'c_call'}, \code{'c_return'}, or \code{'c_exception'}. \var{arg}
+ depends on the event type.
The global trace function is invoked (with \var{event} set to
\code{'call'}) whenever a new local scope is entered; it should return
@@ -390,6 +391,16 @@ An exception has occurred. The local trace function is called;
\var{traceback})}; the return value specifies the new local trace
function.
+\item[\code{'c_call'}]
+A C function is about to be called. This may be an extension function
+or a builtin. \var{arg} is the C function name.
+
+\item[\code{'c_return'}]
+A C function has returned. \var{arg} is \code{None}.
+
+\item[\code{'c_exception'}]
+A C function has thrown an exception. \var{arg} is \code{None}.
+
\end{description}
Note that as an exception is propagated down the chain of callers, an