GH-126833: Dumps graphviz representation of executor graph. (GH-126880)

This commit is contained in:
Mark Shannon 2024-12-13 11:00:00 +00:00 committed by GitHub
parent 5fc6bb2754
commit e62e1ca455
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 230 additions and 2 deletions

View file

@ -2344,6 +2344,30 @@ sys_is_stack_trampoline_active_impl(PyObject *module)
Py_RETURN_FALSE;
}
/*[clinic input]
sys._dump_tracelets
outpath: object
Dump the graph of tracelets in graphviz format
[clinic start generated code]*/
static PyObject *
sys__dump_tracelets_impl(PyObject *module, PyObject *outpath)
/*[clinic end generated code: output=a7fe265e2bc3b674 input=5bff6880cd28ffd1]*/
{
FILE *out = _Py_fopen_obj(outpath, "wb");
if (out == NULL) {
return NULL;
}
int err = _PyDumpExecutors(out);
fclose(out);
if (err) {
return NULL;
}
Py_RETURN_NONE;
}
/*[clinic input]
sys._getframemodulename
@ -2603,6 +2627,7 @@ static PyMethodDef sys_methods[] = {
#endif
SYS__GET_CPU_COUNT_CONFIG_METHODDEF
SYS__IS_GIL_ENABLED_METHODDEF
SYS__DUMP_TRACELETS_METHODDEF
{NULL, NULL} // sentinel
};