summaryrefslogtreecommitdiff
path: root/libguile/gc-segment.c
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@lilypond.org>2005-01-27 22:19:49 +0000
committerHan-Wen Nienhuys <hanwen@lilypond.org>2005-01-27 22:19:49 +0000
commit1367aa5e91ec53a0a251d8a5852294c3f6d581ef (patch)
treeab166b16fa23aaa61e5f2e6c7a0b0c21627d81e7 /libguile/gc-segment.c
parent4d38e6f0e312f82f2dab72e43ca52ff1ff7a5b91 (diff)
downloadguile-1367aa5e91ec53a0a251d8a5852294c3f6d581ef.tar.gz
* gc.c (s_scm_gc_live_object_stats): return alist, not hashtable.
* gc-segment.c (scm_i_all_segments_statistics): new function. (scm_i_heap_segment_statistics): new function * gc.c (s_scm_gc_live_object_stats): new GUILE callable: return statistics on the number of live objects of each type. * gc-card.c (scm_i_tag_name): new function. (scm_i_card_statistics): new function.
Diffstat (limited to 'libguile/gc-segment.c')
-rw-r--r--libguile/gc-segment.c35
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