From: jihoonl Date: Fri, 8 Jan 2010 00:46:29 +0000 (+0000) Subject: recovery stats X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=56fb0b08288b31d7e3779b92c7796642d3e8cb59;p=IRC.git recovery stats --- diff --git a/Robust/src/Runtime/DSTM/interface/dstmserver.c b/Robust/src/Runtime/DSTM/interface/dstmserver.c index 859bc4c7..64a7eb95 100644 --- a/Robust/src/Runtime/DSTM/interface/dstmserver.c +++ b/Robust/src/Runtime/DSTM/interface/dstmserver.c @@ -1063,6 +1063,7 @@ checkversion: close(sd); return; } else { + //Send Update notification msg[0] = THREAD_NOTIFY_RESPONSE; *((unsigned int *)&msg[1]) = oid; diff --git a/Robust/src/Runtime/DSTM/interface_recovery/sockpool.c b/Robust/src/Runtime/DSTM/interface_recovery/sockpool.c index c39f1428..6c5d7452 100644 --- a/Robust/src/Runtime/DSTM/interface_recovery/sockpool.c +++ b/Robust/src/Runtime/DSTM/interface_recovery/sockpool.c @@ -61,7 +61,7 @@ int createNewSocket(unsigned int mid) { int sd; int flag=1; if((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - printf("%s() Error: In creating socket at %s, %d\n", __func__, __FILE__, __LINE__); + fprintf(stderr,"%s() Error: In creating socket at %s, %d\n", __func__, __FILE__, __LINE__); return -1; } setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(flag)); @@ -72,7 +72,7 @@ int createNewSocket(unsigned int mid) { remoteAddr.sin_addr.s_addr = htonl(mid); if(connect(sd, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0) { perror("socket connect: "); - printf("%s(): Error %d connecting to %s:%d\n", __func__, errno, inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT); + fprintf(stderr,"%s(): Error %d connecting to %s:%d\n", __func__, errno, inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT); close(sd); return -1; } diff --git a/Robust/src/Runtime/DSTM/interface_recovery/trans.c b/Robust/src/Runtime/DSTM/interface_recovery/trans.c index 4f98e5e1..2c311720 100644 --- a/Robust/src/Runtime/DSTM/interface_recovery/trans.c +++ b/Robust/src/Runtime/DSTM/interface_recovery/trans.c @@ -111,6 +111,16 @@ unsigned int leader; unsigned int origleader; unsigned int temp_v_a; int paxosRound; + +#ifdef RECOVERYSTATS +/************************************** + * Global variables for Recovery stats + **************************************/ +int numRecovery=0; +unsigned int deadMachine[8]={0,0,0,0,0,0,0,0}; +unsigned double elapsedTime[8] ={0,0,0,0,0,0,0,0}; +#endif + #endif void printhex(unsigned char *, int); @@ -1574,7 +1584,6 @@ void restoreDuplicationState(unsigned int deadHost) { else { // if i am the leader updateLiveHosts(); duplicateLostObjects(deadHost); - printf("%s -> got to this point\n",__func__); if(updateLiveHostsCommit() != 0) { printf("%s -> error updateLiveHostsCommit()\n",__func__); @@ -2500,12 +2509,21 @@ int allHostsLive() { #ifdef RECOVERY void duplicateLostObjects(unsigned int mid){ - printf("Recovery Start"); + +#ifdef RECOVERYSTATS + printf("Recovery Start\n"); + numRecovery++; time_t st = time(NULL); time_t fi; + + deadMachine[numRecovery-1] = mid; +#endif + #ifndef DEBUG printf("%s-> Start, mid: [%s]\n", __func__, midtoIPString(mid)); #endif + + //this needs to be changed. unsigned int backupMid = getBackupMachine(mid); // get backup machine of dead machine @@ -2585,9 +2603,10 @@ void duplicateLostObjects(unsigned int mid){ freeSockWithLock(transPrefetchSockPool, backupMid, sd); } +#ifdef RECOVERYSTATS fi = time(NULL); - - printf("time elapse = %d",fi-st); + elapsedTime[numRecovery-1] = fi-st; +#endif #ifndef DEBUG printf("%s-> End\n", __func__); diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c index f9eaf0c8..ab12a978 100644 --- a/Robust/src/Runtime/runtime.c +++ b/Robust/src/Runtime/runtime.c @@ -11,6 +11,14 @@ #ifdef RECOVERY #include "DSTM/interface_recovery/dstm.h" #include "DSTM/interface_recovery/prelookup.h" + +#ifdef RECOVERYSTATS + extern int numRecovery; + extern unsigned int deadMachine[8]; + extern unsigned int sizeOfRedupedData[8]; + extern double elapsedtime[8]; +#endif + #else #include "DSTM/interface/dstm.h" #include "DSTM/interface/altprelookup.h" @@ -223,6 +231,14 @@ void CALL02(___System______deepArrayCopy____L___Object____L___Object___, struct #endif void CALL11(___System______exit____I,int ___status___, int ___status___) { +#ifdef RECOVERYSTATS + for(int i=0; i < numRecovery; i++) { + printf("Dead Machine = %s\n",midtoIPString(deadThread[i])); + printf("sizeOfRedupedData = %u\n",sizeOfRedupedData[i]); + printf("Elapsed Time = %.2f\n",elapsedTime[i]); + } +#endif + #ifdef TRANSSTATS printf("numTransCommit = %d\n", numTransCommit); printf("numTransAbort = %d\n", numTransAbort);