gh-138385: Sample all interpreters in the tachyon profiler (#138398)

This commit is contained in:
Pablo Galindo Salgado 2025-09-09 00:41:08 +01:00 committed by GitHub
parent 01895d233b
commit 03ee060ec8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 884 additions and 320 deletions

View file

@ -125,28 +125,37 @@ PyDoc_STRVAR(_remote_debugging_RemoteUnwinder_get_stack_trace__doc__,
"get_stack_trace($self, /)\n"
"--\n"
"\n"
"Returns a list of stack traces for threads in the target process.\n"
"Returns stack traces for all interpreters and threads in process.\n"
"\n"
"Each element in the returned list is a tuple of (thread_id, frame_list), where:\n"
"- thread_id is the OS thread identifier\n"
"- frame_list is a list of tuples (function_name, filename, line_number) representing\n"
" the Python stack frames for that thread, ordered from most recent to oldest\n"
"Each element in the returned list is a tuple of (interpreter_id, thread_list), where:\n"
"- interpreter_id is the interpreter identifier\n"
"- thread_list is a list of tuples (thread_id, frame_list) for threads in that interpreter\n"
" - thread_id is the OS thread identifier\n"
" - frame_list is a list of tuples (function_name, filename, line_number) representing\n"
" the Python stack frames for that thread, ordered from most recent to oldest\n"
"\n"
"The threads returned depend on the initialization parameters:\n"
"- If only_active_thread was True: returns only the thread holding the GIL\n"
"- If all_threads was True: returns all threads\n"
"- Otherwise: returns only the main thread\n"
"- If only_active_thread was True: returns only the thread holding the GIL across all interpreters\n"
"- If all_threads was True: returns all threads across all interpreters\n"
"- Otherwise: returns only the main thread of each interpreter\n"
"\n"
"Example:\n"
" [\n"
" (1234, [\n"
" (\'process_data\', \'worker.py\', 127),\n"
" (\'run_worker\', \'worker.py\', 45),\n"
" (\'main\', \'app.py\', 23)\n"
" (0, [ # Main interpreter\n"
" (1234, [\n"
" (\'process_data\', \'worker.py\', 127),\n"
" (\'run_worker\', \'worker.py\', 45),\n"
" (\'main\', \'app.py\', 23)\n"
" ]),\n"
" (1235, [\n"
" (\'handle_request\', \'server.py\', 89),\n"
" (\'serve_forever\', \'server.py\', 52)\n"
" ])\n"
" ]),\n"
" (1235, [\n"
" (\'handle_request\', \'server.py\', 89),\n"
" (\'serve_forever\', \'server.py\', 52)\n"
" (1, [ # Sub-interpreter\n"
" (1236, [\n"
" (\'sub_worker\', \'sub.py\', 15)\n"
" ])\n"
" ])\n"
" ]\n"
"\n"
@ -288,4 +297,4 @@ _remote_debugging_RemoteUnwinder_get_async_stack_trace(PyObject *self, PyObject
return return_value;
}
/*[clinic end generated code: output=0dd1e6e8bab2a8b1 input=a9049054013a1b77]*/
/*[clinic end generated code: output=2ba15411abf82c33 input=a9049054013a1b77]*/