mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
(s_scm_gc_stats): return an entry for total-cells-allocated
too. (gc_update_stats): update scm_gc_cells_allocated_acc too.
This commit is contained in:
parent
73cc2740d4
commit
93632e3cfd
2 changed files with 20 additions and 2 deletions
|
@ -1,3 +1,9 @@
|
|||
2007-01-03 Han-Wen Nienhuys <hanwen@lilypond.org>
|
||||
|
||||
* gc.c (s_scm_gc_stats): return an entry for total-cells-allocated
|
||||
too.
|
||||
(gc_update_stats): update scm_gc_cells_allocated_acc too.
|
||||
|
||||
2006-12-23 Han-Wen Nienhuys <hanwen@lilypond.org>
|
||||
|
||||
* numbers.c (scm_i_fraction_reduce): move logic into
|
||||
|
|
|
@ -208,6 +208,7 @@ unsigned long scm_mtrigger;
|
|||
/* GC Statistics Keeping
|
||||
*/
|
||||
unsigned long scm_cells_allocated = 0;
|
||||
unsigned long scm_last_cells_allocated = 0;
|
||||
unsigned long scm_mallocated = 0;
|
||||
|
||||
/* Global GC sweep statistics since the last full GC. */
|
||||
|
@ -217,6 +218,7 @@ static scm_t_sweep_statistics scm_i_gc_sweep_stats_1 = { 0, 0 };
|
|||
/* Total count of cells marked/swept. */
|
||||
static double scm_gc_cells_marked_acc = 0.;
|
||||
static double scm_gc_cells_swept_acc = 0.;
|
||||
static double scm_gc_cells_allocated_acc = 0.;
|
||||
|
||||
static unsigned long scm_gc_time_taken = 0;
|
||||
static unsigned long t_before_gc;
|
||||
|
@ -246,8 +248,7 @@ SCM_SYMBOL (sym_cells_swept, "cells-swept");
|
|||
SCM_SYMBOL (sym_malloc_yield, "malloc-yield");
|
||||
SCM_SYMBOL (sym_cell_yield, "cell-yield");
|
||||
SCM_SYMBOL (sym_protected_objects, "protected-objects");
|
||||
|
||||
|
||||
SCM_SYMBOL (sym_total_cells_allocated, "total-cells-allocated");
|
||||
|
||||
|
||||
/* Number of calls to SCM_NEWCELL since startup. */
|
||||
|
@ -318,6 +319,7 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0,
|
|||
unsigned long int local_protected_obj_count;
|
||||
double local_scm_gc_cells_swept;
|
||||
double local_scm_gc_cells_marked;
|
||||
double local_scm_total_cells_allocated;
|
||||
SCM answer;
|
||||
unsigned long *bounds = 0;
|
||||
int table_size = scm_i_heap_segment_table_size;
|
||||
|
@ -359,6 +361,9 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0,
|
|||
+(double) scm_i_gc_sweep_stats.swept
|
||||
-(double) scm_i_gc_sweep_stats.collected;
|
||||
|
||||
local_scm_total_cells_allocated = scm_gc_cells_allocated_acc
|
||||
+ (double) (scm_cells_allocated - scm_last_cells_allocated);
|
||||
|
||||
for (i = table_size; i--;)
|
||||
{
|
||||
heap_segs = scm_cons (scm_cons (scm_from_ulong (bounds[2*i]),
|
||||
|
@ -372,6 +377,8 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0,
|
|||
scm_from_ulong (local_scm_gc_time_taken)),
|
||||
scm_cons (sym_cells_allocated,
|
||||
scm_from_ulong (local_scm_cells_allocated)),
|
||||
scm_cons (sym_total_cells_allocated,
|
||||
scm_from_double (local_scm_total_cells_allocated)),
|
||||
scm_cons (sym_heap_size,
|
||||
scm_from_ulong (local_scm_heap_size)),
|
||||
scm_cons (sym_mallocated,
|
||||
|
@ -393,6 +400,7 @@ SCM_DEFINE (scm_gc_stats, "gc-stats", 0, 0, 0,
|
|||
scm_cons (sym_protected_objects,
|
||||
scm_from_ulong (local_protected_obj_count)),
|
||||
scm_cons (sym_heap_segments, heap_segs),
|
||||
|
||||
SCM_UNDEFINED);
|
||||
SCM_CRITICAL_SECTION_END;
|
||||
|
||||
|
@ -422,7 +430,11 @@ gc_update_stats (scm_t_sweep_statistics sweep_stats)
|
|||
abort ();
|
||||
}
|
||||
|
||||
scm_gc_cells_allocated_acc +=
|
||||
(double) (scm_cells_allocated - scm_last_cells_allocated);
|
||||
|
||||
scm_cells_allocated -= sweep_stats.collected;
|
||||
scm_last_cells_allocated = scm_cells_allocated;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue