add support for garbage collection statistics
authorbdemsky <bdemsky>
Tue, 7 Apr 2009 23:46:37 +0000 (23:46 +0000)
committerbdemsky <bdemsky>
Tue, 7 Apr 2009 23:46:37 +0000 (23:46 +0000)
Robust/src/Runtime/garbage.c
Robust/src/buildscript

index 2039ee3aa81b2bb9e4252b45822a3a832c2f8fad..0f6938bd379c0516fad19538f913f0ba8e2bb495 100644 (file)
 
 #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;
index f329e9bca59350b8d2e628d58dd654753072810c..02ddb88ea6c2e2c4ff20d6e12dc3e70b33d8a201 100755 (executable)
@@ -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"