mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
gh-114312: Collect stats for unlikely events (GH-114493)
This commit is contained in:
parent
c63c6142f9
commit
ea3cd0498c
11 changed files with 199 additions and 1 deletions
|
|
@ -1635,6 +1635,21 @@ get_type_module_name(PyObject *self, PyObject *type)
|
|||
return _PyType_GetModuleName((PyTypeObject *)type);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
get_rare_event_counters(PyObject *self, PyObject *type)
|
||||
{
|
||||
PyInterpreterState *interp = PyInterpreterState_Get();
|
||||
|
||||
return Py_BuildValue(
|
||||
"{sksksksksk}",
|
||||
"set_class", interp->rare_events.set_class,
|
||||
"set_bases", interp->rare_events.set_bases,
|
||||
"set_eval_frame_func", interp->rare_events.set_eval_frame_func,
|
||||
"builtin_dict", interp->rare_events.builtin_dict,
|
||||
"func_modification", interp->rare_events.func_modification
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
static PyObject *
|
||||
|
|
@ -1711,6 +1726,7 @@ static PyMethodDef module_functions[] = {
|
|||
{"restore_crossinterp_data", restore_crossinterp_data, METH_VARARGS},
|
||||
_TESTINTERNALCAPI_TEST_LONG_NUMBITS_METHODDEF
|
||||
{"get_type_module_name", get_type_module_name, METH_O},
|
||||
{"get_rare_event_counters", get_rare_event_counters, METH_NOARGS},
|
||||
#ifdef Py_GIL_DISABLED
|
||||
{"py_thread_id", get_py_thread_id, METH_NOARGS},
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue