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.199 2003/02/01 15:43:50 mast Exp $ + || $Id: gc.c,v 1.200 2003/02/08 17:12:27 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.199 2003/02/01 15:43:50 mast Exp $"); + RCSID("$Id: gc.c,v 1.200 2003/02/08 17:12:27 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:189:    * The cycle check functions might recurse another round through the    * frames that have been recursed already, to propagate the GC_LIVE    * flag to things that have been found to be referenced from live    * objects. rec_list is not touched at all in this extra round.    */      static double objects_alloced = 0.0;   static double objects_freed = 0.0;   static double gc_time = 0.0, non_gc_time = 0.0;   static cpu_time_t last_gc_end_time = 0; + #if CPU_TIME_IS_THREAD_LOCAL == NO + cpu_time_t auto_gc_time = 0; + #endif      /* These are only collected for the sake of gc_status. */   static double last_garbage_ratio = 0.0;   static enum {    GARBAGE_RATIO_LOW, GARBAGE_RATIO_HIGH   } last_garbage_strategy = GARBAGE_RATIO_LOW;      struct callback_list gc_callbacks;      struct callback *debug_add_gc_callback(callback_func call,
pike.git/src/gc.c:2897:    new_threshold = (double)(alloc_threshold + start_allocs);   #endif       if(new_threshold < GC_MIN_ALLOC_THRESHOLD)    new_threshold = (double) GC_MIN_ALLOC_THRESHOLD;    else if(new_threshold > GC_MAX_ALLOC_THRESHOLD)    new_threshold = (double) GC_MAX_ALLOC_THRESHOLD;       alloc_threshold = (ptrdiff_t)new_threshold;    +  if (!explicit_call) { + #if CPU_TIME_IS_THREAD_LOCAL == YES +  OBJ2THREAD(Pike_interpreter.thread_id)->auto_gc_time += last_gc_time; + #elif CPU_TIME_IS_THREAD_LOCAL == NO +  auto_gc_time += last_gc_time; + #endif +  } +     if(GC_VERBOSE_DO(1 ||) gc_trace)    {    if (last_gc_time)    fprintf(stderr, "done (%"PRINTSIZET"d of %"PRINTSIZET"d "    "was unreferenced), %ld ms.\n",    unreferenced, start_num_objs,    (long) (last_gc_time / (CPU_TIME_TICKS / 1000)));    else    fprintf(stderr, "done (%"PRINTSIZET"d of %"PRINTSIZET"d "    "was unreferenced)\n",