From: bdemsky Date: Wed, 13 Jul 2011 10:56:28 +0000 (+0000) Subject: code changes...fix all of the statistics collection...clean up collection code X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=a5d1f337572c2a4eea4772fd976bb5f616c21e73;p=IRC.git code changes...fix all of the statistics collection...clean up collection code --- diff --git a/Robust/src/Runtime/bamboo/multicorecache.c b/Robust/src/Runtime/bamboo/multicorecache.c index 377bc698..e5415f69 100644 --- a/Robust/src/Runtime/bamboo/multicorecache.c +++ b/Robust/src/Runtime/bamboo/multicorecache.c @@ -3,9 +3,19 @@ #include "multicoremsg.h" #include "multicoregcprofile.h" +void cacheadapt_finish_compact(void *toptr) { + unsigned int dstpage=(toptr-gcbaseva)>>BAMBOO_PAGE_SIZE_BITS; + unsigned int * newtable=&gccachesamplingtbl_r[dstpage*NUMCORESACTIVE]; + + for(int core = 0; core < NUMCORESACTIVE; core++) { + (*newtable)=(*newtable)>>6; + newtable++; + } +} + void cacheadapt_finish_src_page(void *srcptr, void *tostart, void *tofinish) { unsigned int srcpage=(srcptr-gcbaseva)>>BAMBOO_PAGE_SIZE_BITS; - unsigned int dstpage=(tostart-gcbase)>>BAMBOO_PAGE_SIZE_BITS; + unsigned int dstpage=(tostart-gcbaseva)>>BAMBOO_PAGE_SIZE_BITS; unsigned int numbytes=tofinish-tostart; unsigned int * oldtable=&gccachesamplingtbl[srcpage*NUMCORESACTIVE]; @@ -20,19 +30,22 @@ void cacheadapt_finish_src_page(void *srcptr, void *tostart, void *tofinish) { } } +/* Bytes needed equal to zero is a special case... It means that we should finish the dst page */ + void cacheadapt_finish_dst_page(void *origptr, void *tostart, void *toptr, unsigned int bytesneeded) { unsigned int numbytes=toptr-tostart; - void *tobound=(tostart&~(BAMBOO_PAGE_SIZE-1))+BAMBOO_PAGE_SIZE; - void *origbound=(origstart&~(BAMBOO_PAGE_SIZE-1))+BAMBOO_PAGE_SIZE; + void *tobound=(void *)((((unsigned INTPTR)toptr-1)&~(BAMBOO_PAGE_SIZE-1))+BAMBOO_PAGE_SIZE); + void *origbound=(void *)((((unsigned INTPTR)origptr)&~(BAMBOO_PAGE_SIZE-1))+BAMBOO_PAGE_SIZE); - unsigned int topage=(tostart-gcbase)>>BAMBOO_PAGE_SIZE_BITS; + unsigned int topage=(toptr-1-gcbaseva)>>BAMBOO_PAGE_SIZE_BITS; unsigned int origpage=(origptr-gcbaseva)>>BAMBOO_PAGE_SIZE_BITS; unsigned int * totable=&gccachesamplingtbl_r[topage*NUMCORESACTIVE]; unsigned int * origtable=&gccachesamplingtbl[origpage*NUMCORESACTIVE]; - unsigned int remaintobytes=tobound-toptr; + //handler + unsigned int remaintobytes=(bytesneeded==0)?0:(tobound-toptr); unsigned int remainorigbytes=origbound-origptr; do { @@ -56,7 +69,7 @@ void cacheadapt_finish_dst_page(void *origptr, void *tostart, void *toptr, unsig topage++;//to page is definitely done tobound+=BAMBOO_PAGE_SIZE; origpage=(origptr-gcbaseva)>>BAMBOO_PAGE_SIZE_BITS;//handle exact match case - origbound=(origptr&~(BAMBOO_PAGE_SIZE-1))+BAMBOO_PAGE_SIZE; + origbound=(void *) ((((unsigned INTPTR)origptr)&~(BAMBOO_PAGE_SIZE-1))+BAMBOO_PAGE_SIZE); } else { //Finishing off orig page @@ -370,9 +383,9 @@ void gc_output_cache_sampling() { printf("%x, %d, %d, ",(int)page_sva,page_index,coren); unsigned int * local_tbl = &gccachesamplingtbl[page_index*NUMCORESACTIVE]; for(int i = 0; i < NUMCORESACTIVE; i++) { - int freq = *local_tbl; + unsigned int freq = *local_tbl; local_tbl++; - printf("%d, ", freq); + printf("%u, ", freq); } printf("\n"); } @@ -405,7 +418,7 @@ void gc_output_cache_sampling_r() { int accesscore = 0; // TODO unsigned int * local_tbl = &gccachesamplingtbl_r[page_index*NUMCORESACTIVE]; for(int i = 0; i < NUMCORESACTIVE; i++) { - int freq = *local_tbl; + unsigned int freq = *local_tbl; //printf("%d, ", freq); if(freq != 0) { accesscore++;// TODO @@ -416,8 +429,8 @@ void gc_output_cache_sampling_r() { printf("%x, %d, %d, ",(int)page_sva,page_index,coren); unsigned int * local_tbl = &gccachesamplingtbl_r[page_index*NUMCORESACTIVE]; for(int i = 0; i < NUMCORESACTIVE; i++) { - int freq = *local_tbl; - printf("%d, ", freq); + unsigned int freq = *local_tbl; + printf("%u, ", freq); sumdata[accesscore-1][i]+=freq; local_tbl++; } @@ -430,7 +443,7 @@ void gc_output_cache_sampling_r() { for(int i = 0; i < NUMCORESACTIVE; i++) { printf("%d ", i); for(int j = 0; j < NUMCORESACTIVE; j++) { - printf(" %d ", sumdata[j][i]); + printf(" %u ", sumdata[j][i]); } printf("\n"); } diff --git a/Robust/src/Runtime/bamboo/multicorecache.h b/Robust/src/Runtime/bamboo/multicorecache.h index cf4db76d..1665df4f 100644 --- a/Robust/src/Runtime/bamboo/multicorecache.h +++ b/Robust/src/Runtime/bamboo/multicorecache.h @@ -40,6 +40,7 @@ typedef union #define BAMBOO_CACHE_MODE_NONE 3 // no caching #define BAMBOO_CACHE_MODE_COORDS 4 // cached on a specific core +void cacheadapt_finish_compact(void *toptr); void cacheadapt_finish_src_page(void *srcptr, void *tostart, void *tofinish); void cacheadapt_finish_dst_page(void *origptr, void *tostart, void *toptr, unsigned int bytesneeded); void cacheAdapt_gc(bool isgccachestage); @@ -73,6 +74,7 @@ void gc_output_cache_sampling_r(); #define CACHEADAPT_FINISH_SRC_PAGE(a,b,c) cacheadapt_finish_src_page(a,b,c); #define CACHEADAPT_FINISH_DST_PAGE(a,b,c,d) cacheadapt_finish_dst_page(a,b,c,d); +#define CACHEADAPT_FINISH_COMPACT(a) cacheadapt_finish_compact(a); #define CACHEADAPT_GC(b) cacheAdapt_gc(b) #define CACHEADAPT_MASTER() cacheAdapt_master() @@ -108,6 +110,7 @@ void gc_output_cache_sampling_r(); #define CACHEADAPT_SAMPING_RESET() #define CACHEADAPT_FINISH_SRC_PAGE(a,b,c) #define CACHEADAPT_FINISH_DST_PAGE(a,b,c,d) +#define CACHEADAPT_FINISH_COMPACT(a) #define CACHEADAPT_GC(b) #define CACHEADAPT_MASTER() #define CACHEADAPT_PHASE_CLIENT() diff --git a/Robust/src/Runtime/bamboo/multicoregarbage.c b/Robust/src/Runtime/bamboo/multicoregarbage.c index 3a425768..3e79be10 100644 --- a/Robust/src/Runtime/bamboo/multicoregarbage.c +++ b/Robust/src/Runtime/bamboo/multicoregarbage.c @@ -481,7 +481,7 @@ void gc_master(struct garbagelist * stackptr) { master_finish(); - tprintf("finish GC ! %d \n",gcflag); + //tprintf("finish GC ! %d \n",gcflag); } void pregccheck() { diff --git a/Robust/src/Runtime/bamboo/multicoregccompact.c b/Robust/src/Runtime/bamboo/multicoregccompact.c index ea3264cf..49fd3d93 100644 --- a/Robust/src/Runtime/bamboo/multicoregccompact.c +++ b/Robust/src/Runtime/bamboo/multicoregccompact.c @@ -206,8 +206,10 @@ void compacthelper(struct moveHelper * orig,struct moveHelper * to) { #ifdef GC_CACHE_ADAPT orig->pagebound=orig->base+BAMBOO_PAGE_SIZE; #endif - if (orig->base >= gcbaseva+BAMBOO_SHARED_MEM_SIZE) + if (orig->base >= gcbaseva+BAMBOO_SHARED_MEM_SIZE) { + CACHEADAPT_FINISH_COMPACT(to->ptr); break; + } } if (minimumbytes!=0) { getSpace(to, minimumbytes); @@ -392,7 +394,7 @@ unsigned int compactblockshelper(struct moveHelper * orig, struct moveHelper * t return minimumbytes; } else { CACHEADAPT_FINISH_DST_PAGE(orig->ptr, tmpto, to->ptr, minimumbytes); - to->pagebound=((endtoptr-1)&~(BAMBOO_PAGE_SIZE-1))+BAMBOO_PAGE_SIZE; + to->pagebound=((((unsigned INTPTR)endtoptr)-1)&~(BAMBOO_PAGE_SIZE-1))+BAMBOO_PAGE_SIZE; //update pointers to avoid double counting the stuff we already added in tmporig=orig->ptr+minimumbytes; tmpto=to->ptr+minimumbytes; @@ -490,7 +492,6 @@ void compact() { struct moveHelper to; initOrig_Dst(&orig, &to); - CACHEADAPT_SAMPLING_DATA_REVISE_INIT(&orig, &to); compacthelper(&orig, &to); }