MCPcopy Index your code
hub / github.com/python/cpython / get_object_stats

Method get_object_stats

Tools/scripts/summarize_stats.py:404–438  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

402 return result
403
404 def get_object_stats(self) -> dict[str, tuple[int, int]]:
405 total_materializations = self._data.get("Object inline values", 0)
406 total_allocations = self._data.get("Object allocations", 0) + self._data.get(
407 "Object allocations from freelist", 0
408 )
409 total_increfs = (
410 self._data.get("Object interpreter mortal increfs", 0) +
411 self._data.get("Object mortal increfs", 0) +
412 self._data.get("Object interpreter immortal increfs", 0) +
413 self._data.get("Object immortal increfs", 0)
414 )
415 total_decrefs = (
416 self._data.get("Object interpreter mortal decrefs", 0) +
417 self._data.get("Object mortal decrefs", 0) +
418 self._data.get("Object interpreter immortal decrefs", 0) +
419 self._data.get("Object immortal decrefs", 0)
420 )
421
422 result = {}
423 for key, value in self._data.items():
424 if key.startswith("Object"):
425 if "materialize" in key:
426 den = total_materializations
427 elif "allocations" in key:
428 den = total_allocations
429 elif "increfs" in key:
430 den = total_increfs
431 elif "decrefs" in key:
432 den = total_decrefs
433 else:
434 den = None
435 label = key[6:].strip()
436 label = label[0].upper() + label[1:]
437 result[label] = (value, den)
438 return result
439
440 def get_gc_stats(self) -> list[dict[str, int]]:
441 gc_stats: list[dict[str, int]] = []

Callers 1

calc_object_stats_tableFunction · 0.80

Calls 5

getMethod · 0.45
itemsMethod · 0.45
startswithMethod · 0.45
stripMethod · 0.45
upperMethod · 0.45

Tested by

no test coverage detected