diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2021-07-29 16:26:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 16:26:53 (GMT) |
commit | ddd1c418c05da0de978c75dfb3e4a5b8d27e1d9f (patch) | |
tree | e43ba73ffc54a4e7a5d96c808592e43d40c45a5b /Modules/_opcode.c | |
parent | 6741794dd420c6b9775a188690dbf265037cd69f (diff) | |
download | cpython-ddd1c418c05da0de978c75dfb3e4a5b8d27e1d9f.zip cpython-ddd1c418c05da0de978c75dfb3e4a5b8d27e1d9f.tar.gz cpython-ddd1c418c05da0de978c75dfb3e4a5b8d27e1d9f.tar.bz2 |
bpo-44725 : expose specialization stats in python (GH-27192)
Diffstat (limited to 'Modules/_opcode.c')
-rw-r--r-- | Modules/_opcode.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Modules/_opcode.c b/Modules/_opcode.c index 609a262..d440b5c 100644 --- a/Modules/_opcode.c +++ b/Modules/_opcode.c @@ -1,5 +1,6 @@ #include "Python.h" #include "opcode.h" +#include "internal/pycore_code.h" /*[clinic input] module _opcode @@ -73,9 +74,28 @@ _opcode_stack_effect_impl(PyObject *module, int opcode, PyObject *oparg, return effect; } +/*[clinic input] + +_opcode.get_specialization_stats + +Return the specialization stats +[clinic start generated code]*/ + +static PyObject * +_opcode_get_specialization_stats_impl(PyObject *module) +/*[clinic end generated code: output=fcbc32fdfbec5c17 input=e1f60db68d8ce5f6]*/ +{ +#if SPECIALIZATION_STATS + return _Py_GetSpecializationStats(); +#else + Py_RETURN_NONE; +#endif +} + static PyMethodDef opcode_functions[] = { _OPCODE_STACK_EFFECT_METHODDEF + _OPCODE_GET_SPECIALIZATION_STATS_METHODDEF {NULL, NULL, 0, NULL} }; |