Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
bpo-43760: Add PyThreadState_EnterTracing()#28542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -125,14 +125,31 @@ static inline PyInterpreterState* _PyInterpreterState_GET(void) { | ||
| } | ||
| /* Other */ | ||
| // PyThreadState functions | ||
| PyAPI_FUNC(void) _PyThreadState_Init( | ||
| PyThreadState *tstate); | ||
| PyAPI_FUNC(void) _PyThreadState_DeleteExcept( | ||
| _PyRuntimeState *runtime, | ||
| PyThreadState *tstate); | ||
| static inline void | ||
| _PyThreadState_DisableTracing(PyThreadState *tstate) | ||
| { | ||
| tstate->cframe->use_tracing = 0; | ||
| } | ||
| static inline void | ||
| _PyThreadState_ResetTracing(PyThreadState *tstate) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise this should be "ResumeTracing" | ||
| { | ||
| int use_tracing = (tstate->c_tracefunc != NULL | ||
| || tstate->c_profilefunc != NULL); | ||
| tstate->cframe->use_tracing = (use_tracing ? 255 : 0); | ||
| } | ||
| /* Other */ | ||
| PyAPI_FUNC(PyThreadState *) _PyThreadState_Swap( | ||
| struct _gilstate_runtime_state *gilstate, | ||
| PyThreadState *newts); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| Add new :c:func:`PyThreadState_EnterTracing`, and | ||
| :c:func:`PyThreadState_LeaveTracing` functions to the limited C API to suspend | ||
| and resume tracing and profiling. | ||
| Patch by Victor Stinner. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rename this to "SuspendTracing" as it doesn't really disable it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I like in the internal C API is that we have a great freedom to change anything :-) Sure, I will write a PR to rename functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hoe about Pause/Resume?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a quick Google search. It seems like "suspend" is usually used to "suspend a whole operating time", whereas there are debugger and profilers with a "pause" button and "pause profiling" sounds to be "commonly" used.
My vote goes to PauseTracing/ResumeTracing.
@markshannon: What is your last word on naming? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created #29032