diff options
Diffstat (limited to 'libguile/gc-segment.c')
-rw-r--r-- | libguile/gc-segment.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/libguile/gc-segment.c b/libguile/gc-segment.c index 2ba135c62..fee06e7f9 100644 --- a/libguile/gc-segment.c +++ b/libguile/gc-segment.c @@ -52,6 +52,19 @@ scm_i_make_empty_heap_segment (scm_t_cell_type_statistics *fl) } +void +scm_i_heap_segment_statistics (scm_t_heap_segment *seg, SCM tab) +{ + scm_t_cell *p = seg->bounds[0]; + while (p < seg->bounds[1]) + { + scm_i_card_statistics (p, tab, seg); + p += SCM_GC_CARD_N_CELLS; + } +} + + + /* Fill SEGMENT with memory both for data and mark bits. @@ -331,8 +344,6 @@ scm_i_sweep_some_segments (scm_t_cell_type_statistics * fl) } - - void scm_i_reset_segments (void) { @@ -344,6 +355,26 @@ scm_i_reset_segments (void) } } +/* + Return a hashtab with counts of live objects, with tags as keys. + */ + + +SCM +scm_i_all_segments_statistics (SCM tab) +{ + int i = 0; + for (; i < scm_i_heap_segment_table_size; i++) + { + scm_t_heap_segment * seg = scm_i_heap_segment_table[i]; + scm_i_heap_segment_statistics (seg, tab); + } + + return tab; +} + + + /* Determine whether the given value does actually represent a cell in |