[GC Debugger] Simply and improve GC Debugger Utils (#29029)

Signed-off-by: Jialin Ouyang <Jialin.Ouyang@gmail.com>
This commit is contained in:
Jialin Ouyang
2025-11-20 00:10:22 +00:00
committed by GitHub
parent 5031cd5d55
commit 537cc635c7
2 changed files with 6 additions and 6 deletions
+4 -3
View File
@@ -68,9 +68,10 @@ class GCDebugger:
# Before GC started, record GC start time
# and top collected objects
self.start_time_ns = time.monotonic_ns()
self.gc_top_collected_objects = _compute_top_gc_collected_objects(
gc.get_objects(generation), self.config.top_objects
)
if (top_objects := self.config.top_objects) > 0:
self.gc_top_collected_objects = _compute_top_gc_collected_objects(
gc.get_objects(generation), top_objects
)
elif phase == "stop":
# After GC finished, Record GC elapsed time and
# optionally top collected objects