recovery stats
authorjihoonl <jihoonl>
Fri, 8 Jan 2010 00:46:29 +0000 (00:46 +0000)
committerjihoonl <jihoonl>
Fri, 8 Jan 2010 00:46:29 +0000 (00:46 +0000)
Robust/src/Runtime/DSTM/interface/dstmserver.c
Robust/src/Runtime/DSTM/interface_recovery/sockpool.c
Robust/src/Runtime/DSTM/interface_recovery/trans.c
Robust/src/Runtime/runtime.c

index 859bc4c77641d2ad96e0ff265d9ba6257d71b0b0..64a7eb95cb5c34e8a011a650e55f96ccf524efe6 100644 (file)
@@ -1063,6 +1063,7 @@ checkversion:
            close(sd);
            return;
          } else {
+      
            //Send Update notification
            msg[0] = THREAD_NOTIFY_RESPONSE;
            *((unsigned int *)&msg[1]) = oid;
index c39f142896206050eb5161d61a3431d640769b3a..6c5d74520b4bc2c5f9bb0935de31c124985ac9f1 100644 (file)
@@ -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;
   }
index 4f98e5e1195b9ea833f6b5de47b265e99228ddfe..2c311720ebaef37dca256a054150588819a30b95 100644 (file)
@@ -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__);  
index f9eaf0c894bb7a4069d911a7e985741f03ff55e8..ab12a978c7e054616f693dead484147ed87cc64b 100644 (file)
 #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);