summaryrefslogtreecommitdiffstats
path: root/Include/cpython/pystate.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-10-15 14:06:30 (GMT)
committerGitHub <noreply@github.com>2021-10-15 14:06:30 (GMT)
commit547d26aa08aa5e4ec6e4f8a5587b30b39064a5ba (patch)
treef89a1327f1847ca97929efec97a12cab09478b2a /Include/cpython/pystate.h
parent354c35220d25a893e502014478f6739dad6897f3 (diff)
downloadcpython-547d26aa08aa5e4ec6e4f8a5587b30b39064a5ba.zip
cpython-547d26aa08aa5e4ec6e4f8a5587b30b39064a5ba.tar.gz
cpython-547d26aa08aa5e4ec6e4f8a5587b30b39064a5ba.tar.bz2
bpo-43760: Add PyThreadState_EnterTracing() (GH-28542)
Add PyThreadState_EnterTracing() and PyThreadState_LeaveTracing() functions to the limited C API to suspend and resume tracing and profiling. Add an unit test on the PyThreadState C API to _testcapi. Add also internal _PyThreadState_DisableTracing() and _PyThreadState_ResetTracing().
Diffstat (limited to 'Include/cpython/pystate.h')
-rw-r--r--Include/cpython/pystate.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/Include/cpython/pystate.h b/Include/cpython/pystate.h
index ca0de87..528d2a2 100644
--- a/Include/cpython/pystate.h
+++ b/Include/cpython/pystate.h
@@ -185,6 +185,13 @@ PyAPI_FUNC(PyThreadState *) _PyThreadState_UncheckedGet(void);
PyAPI_FUNC(PyObject *) _PyThreadState_GetDict(PyThreadState *tstate);
+// Disable tracing and profiling.
+PyAPI_FUNC(void) PyThreadState_EnterTracing(PyThreadState *tstate);
+
+// Reset tracing and profiling: enable them if a trace function or a profile
+// function is set, otherwise disable them.
+PyAPI_FUNC(void) PyThreadState_LeaveTracing(PyThreadState *tstate);
+
/* PyGILState */
/* Helper/diagnostic function - return 1 if the current thread