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

Function gc_stats_section

Tools/scripts/summarize_stats.py:1159–1188  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1157
1158
1159def gc_stats_section() -> Section:
1160 def calc_gc_stats(stats: Stats) -> Rows:
1161 gc_stats = stats.get_gc_stats()
1162
1163 return [
1164 (
1165 Count(i),
1166 Count(gen["collections"]),
1167 Count(gen["objects collected"]),
1168 Count(gen["object visits"]),
1169 Count(gen["objects reachable from roots"]),
1170 Count(gen["objects not reachable from roots"]),
1171 )
1172 for (i, gen) in enumerate(gc_stats)
1173 ]
1174
1175 return Section(
1176 "GC stats",
1177 "GC collections and effectiveness",
1178 [
1179 Table(
1180 ("Generation:", "Collections:", "Objects collected:", "Object visits:",
1181 "Reachable from roots:", "Not reachable from roots:"),
1182 calc_gc_stats,
1183 )
1184 ],
1185 doc="""
1186 Collected/visits gives some measure of efficiency.
1187 """,
1188 )
1189
1190
1191def optimization_section() -> Section:

Callers 1

summarize_stats.pyFile · 0.85

Calls 2

SectionClass · 0.70
TableClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…