void commitCountForObjRead(char *, unsigned int *, unsigned int *, int *, int *, int *, int *, int *, unsigned int, unsigned short);
void commitCountForObjMod(char *, unsigned int *, unsigned int *, int *, int *, int *, int *, int *, unsigned int, unsigned short);
+long long myrdtsc(void);
+
/* Sends notification request for thread join, if sucessful returns 0 else returns -1 */
#ifdef RECOVERY
int reqNotify(unsigned int *oidarry, unsigned short *versionarry, unsigned int numoid,int mid);
extern int paxosRound;
/* This function initializes the main objects store and creates the
* global machine and location lookup table */
+
+long long myrdtsc(void)
+{
+ unsigned hi, lo;
+ __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
+ return ( (unsigned long long)lo)|( ((unsigned long long)hi)<<32 );
+}
+
#endif
int dstmInit(void) {
#include <signal.h>
#include <sys/select.h>
#include "tlookup.h"
+
+#define CPU_FREQ 3056842
#endif
#define NUM_THREADS 1
**************************************/
int numRecovery=0;
unsigned int deadMachine[8] ={ 0,0,0,0,0,0,0,0};
-double elapsedTime[8] = {0,0,0,0,0,0,0,0};
+long long elapsedTime[8] = {0,0,0,0,0,0,0,0};
#endif
#endif
#ifdef RECOVERYSTATS
printf("Recovery Start\n");
numRecovery++;
- time_t st;
- time_t fi;
+ long long st;
+ long long fi;
- time(&st);
+ st = myrdtsc(); // to get clock
deadMachine[numRecovery-1] = mid;
#endif
}
#ifdef RECOVERYSTATS
- time(&fi);
- elapsedTime[numRecovery-1] = fi-st;
+ fi = myrdtsc();
+ elapsedTime[numRecovery-1] = (fi-st)/CPU_FREQ;
printRecoveryStat();
#endif
int i;
for(i=0; i < numRecovery;i++) {
printf("Dead Machine = %s\n",midtoIPString(deadMachine[i]));
- printf("Recovery Time = %.6f\n",elapsedTime[i]);
+ printf("Recovery Time = %ld\n",elapsedTime[i]);
}
printf("**************************\n\n");
}