Skip to content

Commit 24db470

Browse files
li1kpamnany
authored andcommitted
Add GC metric last_incremental_sweep (JuliaLang#50190)
* Add GC metric `last_incremental_sweep` * Update gc.c * Update gc.c
1 parent 9c4b578 commit 24db470

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
@@ -25,6 +25,7 @@ struct GC_Num
2525
total_sweep_time ::Int64
2626
total_mark_time ::Int64
2727
last_full_sweep ::Int64
28+
last_incremental_sweep ::Int64
2829
end
2930

3031
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
@@ -3301,6 +3301,9 @@ static int _jl_gc_collect(jl_ptls_t ptls, jl_gc_collection_t collection)
33013301
if (sweep_full) {
33023302
gc_num.last_full_sweep = gc_end_time;
33033303
}
3304+
else {
3305+
gc_num.last_incremental_sweep = gc_end_time;
3306+
}
33043307

33053308
int thrashing = 0; // maybe we should report this to the user or error out?
33063309
size_t heap_size = jl_atomic_load_relaxed(&gc_heap_stats.heap_size);

src/gc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ typedef struct {
8383
uint64_t total_sweep_time;
8484
uint64_t total_mark_time;
8585
uint64_t last_full_sweep;
86+
uint64_t last_incremental_sweep;
8687
} jl_gc_num_t;
8788

8889
// Array chunks (work items representing suffixes of

0 commit comments

Comments
 (0)