From 1fd69ae1a7846062ed915d6e5b1e24bf757bc320 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Tue, 7 Apr 2009 23:46:37 +0000 Subject: [PATCH] add support for garbage collection statistics --- Robust/src/Runtime/garbage.c | 11 ++++++++--- Robust/src/buildscript | 4 ++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Robust/src/Runtime/garbage.c b/Robust/src/Runtime/garbage.c index 2039ee3a..0f6938bd 100644 --- a/Robust/src/Runtime/garbage.c +++ b/Robust/src/Runtime/garbage.c @@ -22,10 +22,10 @@ #define NUMPTRS 100 -#define INITIALHEAPSIZE 32*1024*1024 -#define GCPOINT(x) ((int)((x)*0.9)) +#define INITIALHEAPSIZE 128*1024*1024 +#define GCPOINT(x) ((int)((x)*0.95)) /* This define takes in how full the heap is initially and returns a new heap size to use */ -#define HEAPSIZE(x,y) (((int)((x)/0.6))+y) +#define HEAPSIZE(x,y) ((int)(x+y))*2 #ifdef TASK extern struct genhashtable * activetasks; @@ -636,6 +636,11 @@ void * mygcmalloc(struct garbagelist * stackptr, int size) { /* Update stat on previous gc size */ lastgcsize=(to_heapptr-to_heapbase)+size; +#ifdef GARBAGESTATS + printf("Garbage collected: Old bytes: %u\n", curr_heapptr-curr_heapbase); + printf("New space: %u\n", to_heapptr-to_heapbase); + printf("Total space: %u\n", to_heaptop-to_heapbase); +#endif /* Flip to/curr heaps */ { void * tmp=to_heapbase; diff --git a/Robust/src/buildscript b/Robust/src/buildscript index f329e9bc..02ddb88e 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -35,6 +35,7 @@ echo -optional enable optional echo -debug generate debug symbols echo -prefetch do prefetch analysis echo -transstats generates transaction stats on commits and aborts +echo -garbagestats Print garbage collection statistics echo -webinterface enable web interface echo -runtimedebug printout runtime debug messages echo "-thread use support for multiple threads" @@ -113,6 +114,9 @@ shift elif [[ $1 = '-nojava' ]] then NOJAVA=true +elif [[ $1 = '-garbagestats' ]] +then +EXTRAOPTIONS="$EXTRAOPTIONS -DGARBAGESTATS" elif [[ $1 = '-fastcheck' ]] then EXTRAOPTIONS="$EXTRAOPTIONS -DFASTCHECK" -- 2.34.1