# HG changeset patch # User Nina Engelhardt # Date 1317139679 -7200 # Node ID 5dbcafa5216962b2126024673ce199daee451179 # Parent a82c0a48cdba7d6cff9833b863b5ce3a81d99474 add dependency tracking diff -r a82c0a48cdba -r 5dbcafa52169 SSR_PluginFns.c --- a/SSR_PluginFns.c Tue Sep 27 17:58:45 2011 +0200 +++ b/SSR_PluginFns.c Tue Sep 27 18:07:59 2011 +0200 @@ -140,6 +140,7 @@ void handleDissipate( VirtProcr *requestingPr, SSRSemEnv *semEnv ) { + DEBUG1(dbgRqstHdlr,"Dissipate request from processor %d\n",requestingPr->procrID) //free any semantic data allocated to the virt procr VMS__free( requestingPr->semanticData ); @@ -198,12 +199,22 @@ handleCreate( VMSReqst *req, VirtProcr *requestingPr, SSRSemEnv *semEnv ) { SSRSemReq *semReq; VirtProcr *newPr; - + + DEBUG1(dbgRqstHdlr,"Create request from processor %d ",requestingPr->procrID) + semReq = VMS__take_sem_reqst_from( req ); - + newPr = SSR__create_procr_helper( semReq->fnPtr, semReq->initData, semEnv, semReq->coreToScheduleOnto ); + DEBUG1(dbgRqstHdlr,"(new VP: %d)\n",newPr->procrID) + + #ifdef DETECT_DEPENDENCIES + int lastRecordIdx = requestingPr->counter_history_array_info->numInArray -1; + CounterRecord* lastRecord = requestingPr->counter_history[lastRecordIdx]; + addToDynArray((void*)new_dependency(requestingPr->procrID,lastRecord->task_position,newPr->procrID,0),_VMSMasterEnv->dependenciesInfo); + #endif + //For SSR, caller needs ptr to created processor returned to it requestingPr->dataRetFromReq = newPr; @@ -216,5 +227,11 @@ void resume_procr( VirtProcr *procr, SSRSemEnv *semEnv ) { + #ifdef MEAS__PERF_COUNTERS + int lastRecordIdx = procr->counter_history_array_info->numInArray -1; + CounterRecord* lastRecord = procr->counter_history[lastRecordIdx]; + saveLowTimeStampCountInto(lastRecord->unblocked_timestamp); + #endif + writePrivQ( procr, semEnv->readyVPQs[ procr->coreAnimatedBy] ); } diff -r a82c0a48cdba -r 5dbcafa52169 SSR_Request_Handlers.c --- a/SSR_Request_Handlers.c Tue Sep 27 17:58:45 2011 +0200 +++ b/SSR_Request_Handlers.c Tue Sep 27 18:07:59 2011 +0200 @@ -88,6 +88,8 @@ SSRSemReq *waitingReq; HashEntry *entry; HashTable *commHashTbl = semEnv->commHashTbl; + + DEBUG1(dbgRqstHdlr,"SendType request from processor %d\n",semReq->sendPr->procrID) receivePr = semReq->receivePr; //For "send", know both send & recv procrs sendPr = semReq->sendPr; @@ -118,12 +120,21 @@ SSRSemReq *clonedReq = cloneReq( semReq ); clonedReq-> nextReqInHashEntry = waitingReq->nextReqInHashEntry; waitingReq->nextReqInHashEntry = clonedReq; - DEBUG2( dbgRqstHdlr, "linked requests: %d, %d | ", clonedReq,\ + DEBUG2( dbgRqstHdlr, "linked requests: %p, %p | ", clonedReq,\ waitingReq ) return; } else - { //waiting request is a receive, so it pairs to this send + { + #ifdef DETECT_DEPENDENCIES + int fromRecordIdx = sendPr->counter_history_array_info->numInArray -1; + CounterRecord* fromRecord = sendPr->counter_history[fromRecordIdx]; + int toRecordIdx = receivePr->counter_history_array_info->numInArray -1; + CounterRecord* toRecord = receivePr->counter_history[toRecordIdx]; + addToDynArray((void*)new_dependency(sendPr->procrID,fromRecord->task_position,receivePr->procrID,toRecord->task_position),_VMSMasterEnv->dependenciesInfo); + #endif + + //waiting request is a receive, so it pairs to this send //First, remove the waiting receive request from the entry entry->content = waitingReq->nextReqInHashEntry; VMS__free( waitingReq ); //Don't use contents -- so free it @@ -158,9 +169,19 @@ HashEntry *entry; HashTable *commHashTbl = semEnv->commHashTbl; + DEBUG2(dbgRqstHdlr,"SendFromTo request from processor %d to %d\n",semReq->sendPr->procrID,semReq->receivePr->procrID) + receivePr = semReq->receivePr; //For "send", know both send & recv procrs sendPr = semReq->sendPr; - + + #ifdef DETECT_DEPENDENCIES + int fromRecordIdx = sendPr->counter_history_array_info->numInArray -1; + CounterRecord* fromRecord = sendPr->counter_history[fromRecordIdx]; + int toRecordIdx = receivePr->counter_history_array_info->numInArray -1; + CounterRecord* toRecord = receivePr->counter_history[toRecordIdx]; + addToDynArray((void*)new_dependency(sendPr->procrID,fromRecord->task_position,receivePr->procrID,toRecord->task_position),_VMSMasterEnv->dependenciesInfo); + #endif + key[0] = (int)receivePr->procrID; key[1] = (int)sendPr->procrID; //key[2] acts at the 0 that terminates the string @@ -192,8 +213,8 @@ receivePr->dataRetFromReq = semReq->msg; //bring both processors back from suspend - writePrivQ( sendPr, semEnv->readyVPQs[sendPr->coreAnimatedBy] ); - writePrivQ( receivePr, semEnv->readyVPQs[receivePr->coreAnimatedBy] ); + resume_procr( sendPr, semEnv ); + resume_procr( receivePr, semEnv ); return; } @@ -246,6 +267,8 @@ receivePr = semReq->receivePr; + DEBUG1(dbgRqstHdlr,"ReceiveType request from processor %d\n",receivePr->procrID) + key[0] = (int)receivePr->procrID; key[1] = (int)(semReq->msgType); //key[2] acts as the 0 that terminates the string @@ -260,6 +283,7 @@ if( waitingReq->reqType == send_type ) { //waiting request is a send, so pair it with this receive //first, remove the waiting send request from the list in entry + entry->content = waitingReq->nextReqInHashEntry; if( entry->content == NULL ) { deleteEntryFromTable( entry->key, commHashTbl ); //frees HashEntry @@ -273,8 +297,16 @@ sendPr = waitingReq->sendPr; VMS__free( waitingReq ); - writePrivQ( sendPr, semEnv->readyVPQs[sendPr->coreAnimatedBy] ); - writePrivQ( receivePr, semEnv->readyVPQs[receivePr->coreAnimatedBy] ); + #ifdef DETECT_DEPENDENCIES + int fromRecordIdx = sendPr->counter_history_array_info->numInArray -1; + CounterRecord* fromRecord = sendPr->counter_history[fromRecordIdx]; + int toRecordIdx = receivePr->counter_history_array_info->numInArray -1; + CounterRecord* toRecord = receivePr->counter_history[toRecordIdx]; + addToDynArray((void*)new_dependency(sendPr->procrID,fromRecord->task_position,receivePr->procrID,toRecord->task_position),_VMSMasterEnv->dependenciesInfo); + #endif + + resume_procr( sendPr, semEnv ); + resume_procr( receivePr, semEnv ); return; } @@ -292,6 +324,8 @@ HashEntry *entry; HashTable *commHashTbl = semEnv->commHashTbl; + DEBUG2(dbgRqstHdlr,"ReceiveFromTo request from processor %d to %d\n",semReq->sendPr->procrID,semReq->receivePr->procrID) + receivePr = semReq->receivePr; sendPr = semReq->sendPr; //for receive from-to, know send procr @@ -321,8 +355,8 @@ sendPr = waitingReq->sendPr; VMS__free( waitingReq ); - writePrivQ( sendPr, semEnv->readyVPQs[sendPr->coreAnimatedBy] ); - writePrivQ( receivePr, semEnv->readyVPQs[receivePr->coreAnimatedBy] ); + resume_procr( sendPr, semEnv ); + resume_procr( receivePr, semEnv ); return; } @@ -350,6 +384,8 @@ void handleMalloc( SSRSemReq *semReq, VirtProcr *requestingPr, SSRSemEnv *semEnv ) { void *ptr; + + DEBUG1(dbgRqstHdlr,"Malloc request from processor %d\n",requestingPr->procrID) ptr = VMS__malloc( semReq->sizeToMalloc ); requestingPr->dataRetFromReq = ptr; @@ -361,6 +397,7 @@ void handleFree( SSRSemReq *semReq, VirtProcr *requestingPr, SSRSemEnv *semEnv ) { + DEBUG1(dbgRqstHdlr,"Free request from processor %d\n",requestingPr->procrID) VMS__free( semReq->ptrToFree ); resume_procr( requestingPr, semEnv ); } @@ -398,6 +435,7 @@ handleStartFnSingleton( SSRSemReq *semReq, VirtProcr *requestingPr, SSRSemEnv *semEnv ) { SSRSingleton *singleton; + DEBUG1(dbgRqstHdlr,"StartFnSingleton request from processor %d\n",requestingPr->procrID) singleton = &(semEnv->fnSingletons[ semReq->singletonID ]); handleStartSingleton_helper( singleton, requestingPr, semEnv ); @@ -407,6 +445,7 @@ SSRSemEnv *semEnv ) { SSRSingleton *singleton; + DEBUG1(dbgRqstHdlr,"StartDataSingleton request from processor %d\n",requestingPr->procrID) if( *(semReq->singletonPtrAddr) == NULL ) { singleton = VMS__malloc( sizeof(SSRSingleton) ); singleton->waitQ = makeVMSPrivQ(); @@ -453,6 +492,8 @@ { SSRSingleton *singleton; + DEBUG1(dbgRqstHdlr,"EndFnSingleton request from processor %d\n",requestingPr->procrID) + singleton = &(semEnv->fnSingletons[ semReq->singletonID ]); handleEndSingleton_helper( singleton, requestingPr, semEnv ); } @@ -462,6 +503,8 @@ { SSRSingleton *singleton; + DEBUG1(dbgRqstHdlr,"EndDataSingleton request from processor %d\n",requestingPr->procrID) + singleton = *(semReq->singletonPtrAddr); handleEndSingleton_helper( singleton, requestingPr, semEnv ); } @@ -473,6 +516,7 @@ void handleAtomic( SSRSemReq *semReq, VirtProcr *requestingPr, SSRSemEnv *semEnv ) { + DEBUG1(dbgRqstHdlr,"Atomic request from processor %d\n",requestingPr->procrID) semReq->fnToExecInMaster( semReq->dataForFn ); resume_procr( requestingPr, semEnv ); } @@ -497,6 +541,8 @@ { SSRSemData *semData; TransListElem *nextTransElem; + DEBUG1(dbgRqstHdlr,"TransStart request from processor %d\n",requestingPr->procrID) + //check ordering of entering transactions is correct semData = requestingPr->semanticData; if( semData->highestTransEntered > semReq->transID ) @@ -549,6 +595,8 @@ SSRTrans *transStruc; TransListElem *lastTrans; + DEBUG1(dbgRqstHdlr,"TransEnd request from processor %d\n",requestingPr->procrID) + transStruc = &(semEnv->transactionStrucs[ semReq->transID ]); //make sure transaction ended in same VP as started it.