mirror of
https://github.com/python/cpython.git
synced 2025-08-29 21:25:01 +00:00
GH-93841: Allow stats to be turned on and off, cleared and dumped at runtime. (GH-93843)
This commit is contained in:
parent
c7a79bb036
commit
6f8875eba3
7 changed files with 212 additions and 22 deletions
|
@ -1310,7 +1310,7 @@ eval_frame_handle_pending(PyThreadState *tstate)
|
|||
do { \
|
||||
frame->prev_instr = next_instr++; \
|
||||
OPCODE_EXE_INC(op); \
|
||||
_py_stats.opcode_stats[lastopcode].pair_count[op]++; \
|
||||
if (_py_stats) _py_stats->opcode_stats[lastopcode].pair_count[op]++; \
|
||||
lastopcode = op; \
|
||||
} while (0)
|
||||
#else
|
||||
|
@ -7790,7 +7790,7 @@ _Py_GetDXProfile(PyObject *self, PyObject *args)
|
|||
PyObject *l = PyList_New(257);
|
||||
if (l == NULL) return NULL;
|
||||
for (i = 0; i < 256; i++) {
|
||||
PyObject *x = getarray(_py_stats.opcode_stats[i].pair_count);
|
||||
PyObject *x = getarray(_py_stats_struct.opcode_stats[i].pair_count);
|
||||
if (x == NULL) {
|
||||
Py_DECREF(l);
|
||||
return NULL;
|
||||
|
@ -7804,7 +7804,7 @@ _Py_GetDXProfile(PyObject *self, PyObject *args)
|
|||
}
|
||||
for (i = 0; i < 256; i++) {
|
||||
PyObject *x = PyLong_FromUnsignedLongLong(
|
||||
_py_stats.opcode_stats[i].execution_count);
|
||||
_py_stats_struct.opcode_stats[i].execution_count);
|
||||
if (x == NULL) {
|
||||
Py_DECREF(counts);
|
||||
Py_DECREF(l);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue