From: adash Date: Fri, 25 Sep 2009 08:36:55 +0000 (+0000) Subject: changes to copy remote objs read into prefetch cache X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=b81ef53773a5cb02d9e039aba647aa79def928b6;p=IRC.git changes to copy remote objs read into prefetch cache print transaction stat counters for remote machines --- diff --git a/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.c b/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.c index d97e0b92..d4160902 100644 --- a/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.c +++ b/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.c @@ -121,6 +121,7 @@ void cleanPCache() { int updatePrefetchCache(trans_req_data_t *tdata) { int retval; char oidType; + /*//TODO comment it for now because objects read are already in the prefetch cache oidType = 'R'; if(tdata->f.numread > 0) { if((retval = copyToCache(tdata->f.numread, (unsigned int *)(tdata->objread), oidType)) != 0) { @@ -128,6 +129,7 @@ int updatePrefetchCache(trans_req_data_t *tdata) { return -1; } } + */ if(tdata->f.nummod > 0) { oidType = 'M'; if((retval = copyToCache(tdata->f.nummod, tdata->oidmod, oidType)) != 0) { @@ -142,13 +144,13 @@ int copyToCache(int numoid, unsigned int *oidarray, char oidType) { int i; for (i = 0; i < numoid; i++) { unsigned int oid; - if(oidType == 'R') { - char * objread = (char *) oidarray; - oid = *((unsigned int *)(objread+(sizeof(unsigned int)+ - sizeof(unsigned short))*i)); - } else { + //if(oidType == 'R') { + // char * objread = (char *) oidarray; + // oid = *((unsigned int *)(objread+(sizeof(unsigned int)+ + // sizeof(unsigned short))*i)); + //} else { oid = oidarray[i]; - } + //} pthread_mutex_lock(&prefetchcache_mutex); objheader_t * header; if((header = (objheader_t *) t_chashSearch(oid)) == NULL) { diff --git a/Robust/src/Runtime/DSTM/interface/signal.c b/Robust/src/Runtime/DSTM/interface/signal.c index 85445905..2f9c1105 100644 --- a/Robust/src/Runtime/DSTM/interface/signal.c +++ b/Robust/src/Runtime/DSTM/interface/signal.c @@ -20,7 +20,6 @@ extern int sendRemoteReq; void handle(); extern pfcstats_t *evalPrefetch; -/* void transStatsHandler(int sig, siginfo_t* info, void *context) { #ifdef TRANSSTATS FILE *fp; @@ -39,14 +38,16 @@ void transStatsHandler(int sig, siginfo_t* info, void *context) { fprintf(fp, "bytesSent = %d\n", bytesSent); fprintf(fp, "bytesRecv = %d\n", bytesRecv); fprintf(fp, "totalObjSize= %d\n", totalObjSize); + fprintf(fp, "sendRemoteReq= %d\n", sendRemoteReq); + fprintf(fp, "getResponse= %d\n", getResponse); fprintf(fp, "**********************************\n"); fflush(fp); fclose(fp); exit(0); #endif } -*/ +/* void transStatsHandler(int sig, siginfo_t* info, void *context) { #ifdef TRANSSTATS printf("****** Transaction Stats ******\n"); @@ -67,6 +68,7 @@ void transStatsHandler(int sig, siginfo_t* info, void *context) { exit(0); #endif } +*/ void handle() { #ifdef TRANSSTATS diff --git a/Robust/src/Runtime/DSTM/interface/trans.c b/Robust/src/Runtime/DSTM/interface/trans.c index 97acba76..b53e4bd5 100644 --- a/Robust/src/Runtime/DSTM/interface/trans.c +++ b/Robust/src/Runtime/DSTM/interface/trans.c @@ -641,6 +641,29 @@ __attribute__((pure)) objheader_t *transRead(unsigned int oid) { nRemoteSend++; #endif #ifdef COMPILER +#ifdef CACHE + //Copy object to prefetch cache + pthread_mutex_lock(&prefetchcache_mutex); + objheader_t *headerObj; + int size; + GETSIZE(size, objcopy); + if((headerObj = prefetchobjstrAlloc(size + sizeof(objheader_t))) == NULL) { + printf("%s(): Error in getting memory from prefetch cache at %s, %d\n", __func__, + __FILE__, __LINE__); + pthread_mutex_unlock(&prefetchcache_mutex); + return NULL; + } + pthread_mutex_unlock(&prefetchcache_mutex); + memcpy(headerObj, objcopy, size+sizeof(objheader_t)); + //make an entry in prefetch lookup hashtable + void *oldptr; + if((oldptr = prehashSearch(oid)) != NULL) { + prehashRemove(oid); + prehashInsert(oid, headerObj); + } else { + prehashInsert(oid, headerObj); + } +#endif return &objcopy[1]; #else return objcopy; @@ -725,6 +748,30 @@ __attribute__((pure)) objheader_t *transRead2(unsigned int oid) { nRemoteSend++; #endif #ifdef COMPILER +#ifdef CACHE + //Copy object to prefetch cache + pthread_mutex_lock(&prefetchcache_mutex); + objheader_t *headerObj; + int size; + GETSIZE(size, objcopy); + if((headerObj = prefetchobjstrAlloc(size + sizeof(objheader_t))) == NULL) { + printf("%s(): Error in getting memory from prefetch cache at %s, %d\n", __func__, + __FILE__, __LINE__); + pthread_mutex_unlock(&prefetchcache_mutex); + return NULL; + } + pthread_mutex_unlock(&prefetchcache_mutex); + memcpy(headerObj, objcopy, size+sizeof(objheader_t)); + //make an entry in prefetch lookup hashtable + void *oldptr; + if((oldptr = prehashSearch(oid)) != NULL) { + prehashRemove(oid); + prehashInsert(oid, headerObj); + } else { + prehashInsert(oid, headerObj); + } +#endif + return &objcopy[1]; #else return objcopy;