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.245 2004/03/17 19:27:23 mast Exp $ + || $Id: gc.c,v 1.246 2004/03/19 02:23:26 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:26:   #include "interpret.h"   #include "bignum.h"   #include "pike_threadlib.h"      #include "gc.h"   #include "main.h"   #include <math.h>      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.245 2004/03/17 19:27:23 mast Exp $"); + RCSID("$Id: gc.c,v 1.246 2004/03/19 02:23:26 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:95:   #if defined(GC_VERBOSE) && !defined(PIKE_DEBUG)   #undef GC_VERBOSE   #endif   #ifdef GC_VERBOSE   #define GC_VERBOSE_DO(X) X   #else   #define GC_VERBOSE_DO(X)   #endif      int num_objects = 3; /* Account for *_empty_array. */ - unsigned LONGEST num_allocs =0; - unsigned LONGEST alloc_threshold = GC_MIN_ALLOC_THRESHOLD; + ALLOC_COUNT_TYPE num_allocs =0; + ALLOC_COUNT_TYPE alloc_threshold = GC_MIN_ALLOC_THRESHOLD;   PMOD_EXPORT int Pike_in_gc = 0;   int gc_generation = 0;   time_t last_gc;   int gc_trace = 0, gc_debug = 0;   #ifdef DO_PIKE_CLEANUP   int gc_destruct_everything = 0;   #endif      struct gc_frame   {
pike.git/src/gc.c:2693:    }    if (!p) break;    }    }       CALL_AND_UNSET_ONERROR(tmp);   }      size_t do_gc(void *ignored, int explicit_call)   { -  unsigned LONGEST start_allocs; +  ALLOC_COUNT_TYPE start_allocs;    size_t start_num_objs, unreferenced;    cpu_time_t gc_start_time;    ptrdiff_t objs, pre_kill_objs;   #if defined (PIKE_DEBUG) || defined (DO_PIKE_CLEANUP)    unsigned destroy_count;   #endif   #ifdef PIKE_DEBUG    unsigned obj_count;    ONERROR uwp;   #endif
pike.git/src/gc.c:3187: Inside #if 0
   * at least not in any case when this would help. /mast */    if(alloc_threshold + start_allocs < new_threshold)    new_threshold = (double)(alloc_threshold + start_allocs);   #endif       if(new_threshold < GC_MIN_ALLOC_THRESHOLD)    alloc_threshold = GC_MIN_ALLOC_THRESHOLD;    else if(new_threshold > GC_MAX_ALLOC_THRESHOLD)    alloc_threshold = GC_MAX_ALLOC_THRESHOLD;    else -  alloc_threshold = (unsigned LONGEST) new_threshold; +  alloc_threshold = (ALLOC_COUNT_TYPE) new_threshold;       if (!explicit_call && last_gc_time != (cpu_time_t) -1) {   #if CPU_TIME_IS_THREAD_LOCAL == PIKE_YES    Pike_interpreter.thread_state->auto_gc_time += last_gc_time;   #elif CPU_TIME_IS_THREAD_LOCAL == PIKE_NO    auto_gc_time += last_gc_time;   #endif    }       if(GC_VERBOSE_DO(1 ||) gc_trace)
pike.git/src/gc.c:3344:    push_constant_text("last_gc");    push_int64(last_gc);    size++;       f_aggregate_mapping(size * 2);   }      void dump_gc_info(void)   {    fprintf(stderr,"Current number of things : %d\n",num_objects); -  fprintf(stderr,"Allocations since last gc : %"PRINTLONGEST"u\n",num_allocs); -  fprintf(stderr,"Threshold for next gc : %"PRINTLONGEST"u\n",alloc_threshold); +  fprintf(stderr,"Allocations since last gc : "PRINT_ALLOC_COUNT_TYPE"\n", +  num_allocs); +  fprintf(stderr,"Threshold for next gc : "PRINT_ALLOC_COUNT_TYPE"\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 "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);