Skip to content

Commit

Permalink
Add GC metric last_incremental_sweep (JuliaLang#50190)
Browse files Browse the repository at this point in the history
* Add GC metric `last_incremental_sweep`

* Update gc.c

* Update gc.c
  • Loading branch information
li1 authored and RAI CI (GitHub Action Automation) committed Sep 25, 2023
1 parent e475f65 commit 4b7c0d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/timing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct GC_Num
total_sweep_time ::Int64
total_mark_time ::Int64
last_full_sweep ::Int64
last_incremental_sweep ::Int64
end

gc_num() = ccall(:jl_gc_num, GC_Num, ())
Expand Down
3 changes: 3 additions & 0 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3302,6 +3302,9 @@ static int _jl_gc_collect(jl_ptls_t ptls, jl_gc_collection_t collection)
if (sweep_full) {
gc_num.last_full_sweep = gc_end_time;
}
else {
gc_num.last_incremental_sweep = gc_end_time;
}

size_t heap_size = jl_atomic_load_relaxed(&gc_heap_stats.heap_size);
double target_allocs = 0.0;
Expand Down
1 change: 1 addition & 0 deletions src/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ typedef struct {
uint64_t total_sweep_time;
uint64_t total_mark_time;
uint64_t last_full_sweep;
uint64_t last_incremental_sweep;
} jl_gc_num_t;

// Array chunks (work items representing suffixes of
Expand Down

0 comments on commit 4b7c0d6

Please sign in to comment.