mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
Improve object stats (#92845)
* Add incref/decref stats * Show ratios for allocation in summary
This commit is contained in:
parent
f6fd8aac13
commit
fa2b8b75eb
10 changed files with 106 additions and 55 deletions
|
@ -55,6 +55,7 @@
|
|||
#undef Py_DECREF
|
||||
#define Py_DECREF(arg) \
|
||||
do { \
|
||||
_Py_DECREF_STAT_INC(); \
|
||||
PyObject *op = _PyObject_CAST(arg); \
|
||||
if (--op->ob_refcnt == 0) { \
|
||||
destructor dealloc = Py_TYPE(op)->tp_dealloc; \
|
||||
|
@ -78,6 +79,7 @@
|
|||
#undef _Py_DECREF_SPECIALIZED
|
||||
#define _Py_DECREF_SPECIALIZED(arg, dealloc) \
|
||||
do { \
|
||||
_Py_DECREF_STAT_INC(); \
|
||||
PyObject *op = _PyObject_CAST(arg); \
|
||||
if (--op->ob_refcnt == 0) { \
|
||||
destructor d = (destructor)(dealloc); \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue