From c952d330dd346884b321a60b94bd8446d0eb98b9 Mon Sep 17 00:00:00 2001 From: jihoonl Date: Wed, 17 Feb 2010 00:14:42 +0000 Subject: [PATCH] debug --- Robust/src/Runtime/DSTM/interface_recovery/llookup.c | 6 +++--- Robust/src/Runtime/DSTM/interface_recovery/tlookup.c | 6 +++--- Robust/src/Runtime/DSTM/interface_recovery/trans.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Robust/src/Runtime/DSTM/interface_recovery/llookup.c b/Robust/src/Runtime/DSTM/interface_recovery/llookup.c index ec49a90a..99597bb2 100644 --- a/Robust/src/Runtime/DSTM/interface_recovery/llookup.c +++ b/Robust/src/Runtime/DSTM/interface_recovery/llookup.c @@ -76,6 +76,7 @@ unsigned int lhashInsert(unsigned int oid, unsigned int mid) { pthread_mutex_unlock(&llookup.locktable); } + pthread_mutex_lock(&llookup.locktable); ptr = llookup.table; llookup.numelements++; @@ -83,7 +84,6 @@ unsigned int lhashInsert(unsigned int oid, unsigned int mid) { #ifdef DEBUG printf("DEBUG(insert) oid = %d, mid =%d, index =%d\n",oid,mid, index); #endif - pthread_mutex_lock(&llookup.locktable); if(ptr[index].next == NULL && ptr[index].oid == 0) { // Insert at the first position in the hashtable ptr[index].oid = oid; ptr[index].mid = mid; @@ -108,10 +108,10 @@ unsigned int lhashSearch(unsigned int oid) { int index; lhashlistnode_t *ptr, *node; + pthread_mutex_lock(&llookup.locktable); ptr = llookup.table; // Address of the beginning of hash table index = lhashFunction(oid); node = &ptr[index]; - pthread_mutex_lock(&llookup.locktable); while(node != NULL) { if(node->oid == oid) { pthread_mutex_unlock(&llookup.locktable); @@ -129,11 +129,11 @@ unsigned int lhashRemove(unsigned int oid) { lhashlistnode_t *curr, *prev; lhashlistnode_t *ptr, *node; + pthread_mutex_lock(&llookup.locktable); ptr = llookup.table; index = lhashFunction(oid); curr = &ptr[index]; - pthread_mutex_lock(&llookup.locktable); for (; curr != NULL; curr = curr->next) { if (curr->oid == oid) { // Find a match in the hash table llookup.numelements--; // Decrement the number of elements in the global hashtable diff --git a/Robust/src/Runtime/DSTM/interface_recovery/tlookup.c b/Robust/src/Runtime/DSTM/interface_recovery/tlookup.c index 06666d6d..494d1a5a 100644 --- a/Robust/src/Runtime/DSTM/interface_recovery/tlookup.c +++ b/Robust/src/Runtime/DSTM/interface_recovery/tlookup.c @@ -41,10 +41,10 @@ unsigned int thashInsert(unsigned int transid, char decision) { pthread_mutex_unlock(&tlookup.locktable); } + index = thashFunction(transid); ptr = tlookup.table; tlookup.numelements++; - index = thashFunction(transid); #ifdef DEBUG printf("DEBUG(insert) transid = %d, decision = %d, index = %d\n",transid, decision, index); #endif @@ -73,10 +73,10 @@ char thashSearch(unsigned int transid) { int index; thashlistnode_t *ptr, *node; + pthread_mutex_lock(&tlookup.locktable); ptr = tlookup.table; // Address of the beginning of hash table index = thashFunction(transid); node = &ptr[index]; - pthread_mutex_lock(&tlookup.locktable); while(node != NULL) { if(node->transid == transid) { pthread_mutex_unlock(&tlookup.locktable); @@ -94,11 +94,11 @@ unsigned int thashRemove(unsigned int transid) { thashlistnode_t *curr, *prev; thashlistnode_t *ptr, *node; + pthread_mutex_lock(&tlookup.locktable); ptr = tlookup.table; index = thashFunction(transid); curr = &ptr[index]; - pthread_mutex_lock(&tlookup.locktable); for (; curr != NULL; curr = curr->next) { if (curr->transid == transid) { // Find a match in the hash table tlookup.numelements--; // Decrement the number of elements in the global hashtable diff --git a/Robust/src/Runtime/DSTM/interface_recovery/trans.c b/Robust/src/Runtime/DSTM/interface_recovery/trans.c index 590bcc79..46a19dd9 100644 --- a/Robust/src/Runtime/DSTM/interface_recovery/trans.c +++ b/Robust/src/Runtime/DSTM/interface_recovery/trans.c @@ -2614,7 +2614,7 @@ void duplicateLostObjects(unsigned int mid){ #ifdef RECOVERYSTATS time(&fi); - elapsedTime[numRecovery-1] = difftime(fi,st); + elapsedTime[numRecovery-1] = fi-st; printRecoveryStat(); #endif -- 2.34.1