Branch: Tag:

2003-02-09

2003-02-09 15:30:57 by Martin Stjernholm <mast@lysator.liu.se>

Better error reporting from get_cpu_time and (pike) gethrvtime.

Rev: src/builtin_functions.c:1.472
Rev: src/gc.c:1.202
Rev: src/pike_rusage.h:1.14
Rev: src/rusage.c:1.32

2:   || 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.201 2003/02/09 13:35:29 mast Exp $ + || $Id: gc.c,v 1.202 2003/02/09 15:30:57 mast Exp $   */      #include "global.h"
33:      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.201 2003/02/09 13:35:29 mast Exp $"); + RCSID("$Id: gc.c,v 1.202 2003/02/09 15:30:57 mast Exp $");      int gc_enabled = 1;   
2851:    non_gc_time = non_gc_time * multiplier +    last_non_gc_time * (1.0 - multiplier);    } -  else last_non_gc_time = 0; +  else last_non_gc_time = (cpu_time_t) -1;    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; +  else last_gc_time = (cpu_time_t) -1;       /* At this point, unreferenced contains the number of things that    * were without external references during the check and mark
2874:    objects_freed = objects_freed * multiplier +    unreferenced * (1.0 - multiplier);    -  if (!last_non_gc_time || gc_time / non_gc_time <= gc_time_ratio) { +  if (last_non_gc_time == (cpu_time_t) -1 || +  gc_time / non_gc_time <= gc_time_ratio) {    /* Calculate the new threshold by adjusting the average    * threshold (objects_alloced) with the ratio between the wanted    * garbage at the next gc (gc_garbage_ratio_low *
2908:       alloc_threshold = (ptrdiff_t)new_threshold;    -  if (!explicit_call) { +  if (!explicit_call && last_gc_time != (cpu_time_t) -1) {   #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
2918:       if(GC_VERBOSE_DO(1 ||) gc_trace)    { -  if (last_gc_time) +  if (last_gc_time != (cpu_time_t) -1)    fprintf(stderr, "done (%"PRINTSIZET"d of %"PRINTSIZET"d "    "was unreferenced), %ld ms.\n",    unreferenced, start_num_objs,