Skip to content

Commit 2db2df6

Browse files
Add heap_size and work_to_do
1 parent 2b6cfaa commit 2db2df6

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Include/internal/pycore_interp_structs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,11 @@ struct gc_generation_stats {
195195
Py_ssize_t objects_transitively_reachable;
196196
Py_ssize_t objects_not_transitively_reachable;
197197

198+
Py_ssize_t heap_size;
199+
Py_ssize_t work_to_do;
200+
198201
double duration;
202+
double total_duration;
199203
};
200204

201205
struct gc_generation_stats_buffer {

Python/gc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1422,7 +1422,10 @@ add_stats(GCState *gcstate, int gen, struct gc_generation_stats *stats)
14221422
cur_stats->objects_not_transitively_reachable = prev_stats->objects_not_transitively_reachable + stats->objects_not_transitively_reachable;
14231423
cur_stats->uncollectable = prev_stats->uncollectable + stats->uncollectable;
14241424
cur_stats->candidates = prev_stats->candidates + stats->candidates;
1425-
cur_stats->duration = prev_stats->duration + stats->duration;
1425+
cur_stats->duration = stats->duration;
1426+
cur_stats->total_duration = prev_stats->total_duration + stats->duration;
1427+
cur_stats->heap_size = gcstate->heap_size;
1428+
cur_stats->work_to_do = gcstate->work_to_do;
14261429
}
14271430

14281431
static void

0 commit comments

Comments
 (0)