diff options
author | Victor Stinner <vstinner@python.org> | 2020-02-03 14:17:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-03 14:17:15 (GMT) |
commit | c6e5c1123bac6cbb4c85265155af5349dcea522e (patch) | |
tree | c9bc04bdd74fbf9d8f86dd1999d8acc0f4655fc3 /Objects/tupleobject.c | |
parent | 869c0c99b94ff9527acc1ca060164ab3d1bdcc53 (diff) | |
download | cpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.zip cpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.tar.gz cpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.tar.bz2 |
bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)
Remove:
* COUNT_ALLOCS macro
* sys.getcounts() function
* SHOW_ALLOC_COUNT code in listobject.c
* SHOW_TRACK_COUNT code in tupleobject.c
* PyConfig.show_alloc_count field
* -X showalloccount command line option
* @test.support.requires_type_collecting decorator
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r-- | Objects/tupleobject.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c index 08f7022..2708b9a 100644 --- a/Objects/tupleobject.c +++ b/Objects/tupleobject.c @@ -28,43 +28,10 @@ class tuple "PyTupleObject *" "&PyTuple_Type" static PyTupleObject *free_list[PyTuple_MAXSAVESIZE]; static int numfree[PyTuple_MAXSAVESIZE]; #endif -#ifdef COUNT_ALLOCS -Py_ssize_t _Py_fast_tuple_allocs; -Py_ssize_t _Py_tuple_zero_allocs; -#endif - -/* Debug statistic to count GC tracking of tuples. - Please note that tuples are only untracked when considered by the GC, and - many of them will be dead before. Therefore, a tracking rate close to 100% - does not necessarily prove that the heuristic is inefficient. -*/ -#ifdef SHOW_TRACK_COUNT -static Py_ssize_t count_untracked = 0; -static Py_ssize_t count_tracked = 0; - -static void -show_track(void) -{ - PyInterpreterState *interp = _PyInterpreterState_Get(); - if (!interp->config.show_alloc_count) { - return; - } - - fprintf(stderr, "Tuples created: %" PY_FORMAT_SIZE_T "d\n", - count_tracked + count_untracked); - fprintf(stderr, "Tuples tracked by the GC: %" PY_FORMAT_SIZE_T - "d\n", count_tracked); - fprintf(stderr, "%.2f%% tuple tracking rate\n\n", - (100.0*count_tracked/(count_untracked+count_tracked))); -} -#endif static inline void tuple_gc_track(PyTupleObject *op) { -#ifdef SHOW_TRACK_COUNT - count_tracked++; -#endif _PyObject_GC_TRACK(op); } @@ -106,9 +73,6 @@ tuple_alloc(Py_ssize_t size) assert(size != 0); free_list[size] = (PyTupleObject *) op->ob_item[0]; numfree[size]--; -#ifdef COUNT_ALLOCS - _Py_fast_tuple_allocs++; -#endif /* Inline PyObject_InitVar */ #ifdef Py_TRACE_REFS Py_SIZE(op) = size; @@ -139,9 +103,6 @@ PyTuple_New(Py_ssize_t size) if (size == 0 && free_list[0]) { op = free_list[0]; Py_INCREF(op); -#ifdef COUNT_ALLOCS - _Py_tuple_zero_allocs++; -#endif return (PyObject *) op; } #endif @@ -227,10 +188,6 @@ _PyTuple_MaybeUntrack(PyObject *op) _PyObject_GC_MAY_BE_TRACKED(elt)) return; } -#ifdef SHOW_TRACK_COUNT - count_tracked--; - count_untracked++; -#endif _PyObject_GC_UNTRACK(op); } @@ -1001,9 +958,6 @@ _PyTuple_Fini(void) (void)PyTuple_ClearFreeList(); #endif -#ifdef SHOW_TRACK_COUNT - show_track(); -#endif } /*********************** Tuple Iterator **************************/ |