pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: gc.c,v 1.197 2003/01/14 19:20:24 mast Exp $ + || $Id: gc.c,v 1.198 2003/01/15 21:41:28 mast Exp $   */      #include "global.h"      struct callback *gc_evaluator_callback=0;      #include "array.h"   #include "multiset.h"   #include "mapping.h"   #include "object.h"
pike.git/src/gc.c:25:   #include "constants.h"   #include "interpret.h"   #include "bignum.h"      #include "gc.h"   #include "main.h"   #include <math.h>      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.197 2003/01/14 19:20:24 mast Exp $"); + RCSID("$Id: gc.c,v 1.198 2003/01/15 21:41:28 mast Exp $");      int gc_enabled = 1;      /* These defaults are only guesses and hardly tested at all. Please improve. */   double gc_garbage_ratio_low = 0.2;   double gc_time_ratio = 0.05;   double gc_garbage_ratio_high = 0.5;      /* This slowness factor approximately corresponds to the average over    * the last ten gc rounds. (0.9 == 1 - 1/10) */
pike.git/src/gc.c:2431: Inside #if defined(PIKE_DEBUG)
   hrtime_t gcstarttime = 0;   #endif    unsigned destroy_count, obj_count;    ONERROR uwp;   #endif       if(Pike_in_gc) return 0;       if (gc_enabled <= 0 && (gc_enabled < 0 || !explicit_call)) {    num_allocs = 0; +  alloc_threshold = GC_MAX_ALLOC_THRESHOLD;    if (gc_evaluator_callback) {    remove_callback (gc_evaluator_callback);    gc_evaluator_callback = NULL;    }    return 0;    }      #ifdef DEBUG_MALLOC    if(debug_options & GC_RESET_DMALLOC)    reset_debug_malloc();
pike.git/src/gc.c:2816:    multiplier=pow(gc_average_slowness,    (double) start_allocs / (double) alloc_threshold);       /* Comparisons to avoid that overflows mess up the statistics. */    if (gc_start_time > last_gc_end_time) {    last_non_gc_time = gc_start_time - last_gc_end_time;    non_gc_time = non_gc_time * multiplier +    last_non_gc_time * (1.0 - multiplier);    }    else last_non_gc_time = 0; -  last_gc_end_time = internal_rusage(); +  last_gc_end_time = get_cpu_time();    if (last_gc_end_time > gc_start_time) {    last_gc_time = last_gc_end_time - gc_start_time;    gc_time = gc_time * multiplier +    last_gc_time * (1.0 - multiplier);    }    else last_gc_time = 0;       /* At this point, unreferenced contains the number of things that    * were without external references during the check and mark    * passes. In the process of freeing them, destroy functions might
pike.git/src/gc.c:3018:    fprintf(stderr,"Current number of things : %d\n",num_objects);    fprintf(stderr,"Allocations since last gc : %d\n",num_allocs);    fprintf(stderr,"Threshold for next gc : %"PRINTPTRDIFFT"d\n",alloc_threshold);    fprintf(stderr,"Projected current garbage : %f\n",    objects_freed * (double) num_allocs / (double) alloc_threshold);       fprintf(stderr,"Avg allocs between gc : %f\n",objects_alloced);    fprintf(stderr,"Avg frees per gc : %f\n",objects_freed);    fprintf(stderr,"Garbage ratio in last gc : %f\n", last_garbage_ratio);    -  fprintf(stderr,"Avg cpu ms between gc : %f\n", non_gc_time); -  fprintf(stderr,"Avg cpu ms in gc : %f\n", gc_time); +  fprintf(stderr,"Avg cpu "CPU_TIME_UNIT" between gc : %f\n", non_gc_time); +  fprintf(stderr,"Avg cpu "CPU_TIME_UNIT" in gc : %f\n", gc_time);    fprintf(stderr,"Avg time ratio in gc : %f\n", gc_time / non_gc_time);       fprintf(stderr,"Garbage strategy in last gc: %s\n",    last_garbage_strategy == GARBAGE_RATIO_LOW ? "garbage_ratio_low" :    last_garbage_strategy == GARBAGE_RATIO_HIGH ? "garbage_ratio_high" :    "???");      #ifdef PIKE_DEBUG    fprintf(stderr,"Max used gc frames : %u\n", max_tot_gc_frames);    fprintf(stderr,"Live recursed ratio : %g\n",