Skip to content

Commit 304e9a0

Browse files
authored
Add GC metric last_full_sweep (#50018)
Records the time that the last full sweep ran.
1 parent e4cf096 commit 304e9a0

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

base/timing.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ struct GC_Num
2424
mark_time ::Int64
2525
total_sweep_time ::Int64
2626
total_mark_time ::Int64
27+
last_full_sweep ::Int64
2728
end
2829

2930
gc_num() = ccall(:jl_gc_num, GC_Num, ())

src/gc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,6 +3392,9 @@ static int _jl_gc_collect(jl_ptls_t ptls, jl_gc_collection_t collection)
33923392
uint64_t sweep_time = gc_end_time - start_sweep_time;
33933393
gc_num.total_sweep_time += sweep_time;
33943394
gc_num.sweep_time = sweep_time;
3395+
if (sweep_full) {
3396+
gc_num.last_full_sweep = gc_end_time;
3397+
}
33953398

33963399
// sweeping is over
33973400
// 7. if it is a quick sweep, put back the remembered objects in queued state

src/gc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ typedef struct {
8181
uint64_t mark_time;
8282
uint64_t total_sweep_time;
8383
uint64_t total_mark_time;
84+
uint64_t last_full_sweep;
8485
} jl_gc_num_t;
8586

8687
// Array chunks (work items representing suffixes of

0 commit comments

Comments
 (0)