Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
changeset 36:5dbcafa52169 perf_counters
add dependency tracking
| author | Nina Engelhardt |
|---|---|
| date | Tue, 27 Sep 2011 18:07:59 +0200 |
| parents | a82c0a48cdba |
| children | 6a367b5d9a2d |
| files | SSR_PluginFns.c SSR_Request_Handlers.c |
| diffstat | 2 files changed, 76 insertions(+), 11 deletions(-) [+] |
line diff
1.1 --- a/SSR_PluginFns.c Tue Sep 27 17:58:45 2011 +0200 1.2 +++ b/SSR_PluginFns.c Tue Sep 27 18:07:59 2011 +0200 1.3 @@ -140,6 +140,7 @@ 1.4 void 1.5 handleDissipate( VirtProcr *requestingPr, SSRSemEnv *semEnv ) 1.6 { 1.7 + DEBUG1(dbgRqstHdlr,"Dissipate request from processor %d\n",requestingPr->procrID) 1.8 //free any semantic data allocated to the virt procr 1.9 VMS__free( requestingPr->semanticData ); 1.10 1.11 @@ -198,12 +199,22 @@ 1.12 handleCreate( VMSReqst *req, VirtProcr *requestingPr, SSRSemEnv *semEnv ) 1.13 { SSRSemReq *semReq; 1.14 VirtProcr *newPr; 1.15 - 1.16 + 1.17 + DEBUG1(dbgRqstHdlr,"Create request from processor %d ",requestingPr->procrID) 1.18 + 1.19 semReq = VMS__take_sem_reqst_from( req ); 1.20 - 1.21 + 1.22 newPr = SSR__create_procr_helper( semReq->fnPtr, semReq->initData, semEnv, 1.23 semReq->coreToScheduleOnto ); 1.24 1.25 + DEBUG1(dbgRqstHdlr,"(new VP: %d)\n",newPr->procrID) 1.26 + 1.27 + #ifdef DETECT_DEPENDENCIES 1.28 + int lastRecordIdx = requestingPr->counter_history_array_info->numInArray -1; 1.29 + CounterRecord* lastRecord = requestingPr->counter_history[lastRecordIdx]; 1.30 + addToDynArray((void*)new_dependency(requestingPr->procrID,lastRecord->task_position,newPr->procrID,0),_VMSMasterEnv->dependenciesInfo); 1.31 + #endif 1.32 + 1.33 //For SSR, caller needs ptr to created processor returned to it 1.34 requestingPr->dataRetFromReq = newPr; 1.35 1.36 @@ -216,5 +227,11 @@ 1.37 void 1.38 resume_procr( VirtProcr *procr, SSRSemEnv *semEnv ) 1.39 { 1.40 + #ifdef MEAS__PERF_COUNTERS 1.41 + int lastRecordIdx = procr->counter_history_array_info->numInArray -1; 1.42 + CounterRecord* lastRecord = procr->counter_history[lastRecordIdx]; 1.43 + saveLowTimeStampCountInto(lastRecord->unblocked_timestamp); 1.44 + #endif 1.45 + 1.46 writePrivQ( procr, semEnv->readyVPQs[ procr->coreAnimatedBy] ); 1.47 }
2.1 --- a/SSR_Request_Handlers.c Tue Sep 27 17:58:45 2011 +0200 2.2 +++ b/SSR_Request_Handlers.c Tue Sep 27 18:07:59 2011 +0200 2.3 @@ -88,6 +88,8 @@ 2.4 SSRSemReq *waitingReq; 2.5 HashEntry *entry; 2.6 HashTable *commHashTbl = semEnv->commHashTbl; 2.7 + 2.8 + DEBUG1(dbgRqstHdlr,"SendType request from processor %d\n",semReq->sendPr->procrID) 2.9 2.10 receivePr = semReq->receivePr; //For "send", know both send & recv procrs 2.11 sendPr = semReq->sendPr; 2.12 @@ -118,12 +120,21 @@ 2.13 SSRSemReq *clonedReq = cloneReq( semReq ); 2.14 clonedReq-> nextReqInHashEntry = waitingReq->nextReqInHashEntry; 2.15 waitingReq->nextReqInHashEntry = clonedReq; 2.16 - DEBUG2( dbgRqstHdlr, "linked requests: %d, %d | ", clonedReq,\ 2.17 + DEBUG2( dbgRqstHdlr, "linked requests: %p, %p | ", clonedReq,\ 2.18 waitingReq ) 2.19 return; 2.20 } 2.21 else 2.22 - { //waiting request is a receive, so it pairs to this send 2.23 + { 2.24 + #ifdef DETECT_DEPENDENCIES 2.25 + int fromRecordIdx = sendPr->counter_history_array_info->numInArray -1; 2.26 + CounterRecord* fromRecord = sendPr->counter_history[fromRecordIdx]; 2.27 + int toRecordIdx = receivePr->counter_history_array_info->numInArray -1; 2.28 + CounterRecord* toRecord = receivePr->counter_history[toRecordIdx]; 2.29 + addToDynArray((void*)new_dependency(sendPr->procrID,fromRecord->task_position,receivePr->procrID,toRecord->task_position),_VMSMasterEnv->dependenciesInfo); 2.30 + #endif 2.31 + 2.32 + //waiting request is a receive, so it pairs to this send 2.33 //First, remove the waiting receive request from the entry 2.34 entry->content = waitingReq->nextReqInHashEntry; 2.35 VMS__free( waitingReq ); //Don't use contents -- so free it 2.36 @@ -158,9 +169,19 @@ 2.37 HashEntry *entry; 2.38 HashTable *commHashTbl = semEnv->commHashTbl; 2.39 2.40 + DEBUG2(dbgRqstHdlr,"SendFromTo request from processor %d to %d\n",semReq->sendPr->procrID,semReq->receivePr->procrID) 2.41 + 2.42 receivePr = semReq->receivePr; //For "send", know both send & recv procrs 2.43 sendPr = semReq->sendPr; 2.44 - 2.45 + 2.46 + #ifdef DETECT_DEPENDENCIES 2.47 + int fromRecordIdx = sendPr->counter_history_array_info->numInArray -1; 2.48 + CounterRecord* fromRecord = sendPr->counter_history[fromRecordIdx]; 2.49 + int toRecordIdx = receivePr->counter_history_array_info->numInArray -1; 2.50 + CounterRecord* toRecord = receivePr->counter_history[toRecordIdx]; 2.51 + addToDynArray((void*)new_dependency(sendPr->procrID,fromRecord->task_position,receivePr->procrID,toRecord->task_position),_VMSMasterEnv->dependenciesInfo); 2.52 + #endif 2.53 + 2.54 key[0] = (int)receivePr->procrID; 2.55 key[1] = (int)sendPr->procrID; 2.56 //key[2] acts at the 0 that terminates the string 2.57 @@ -192,8 +213,8 @@ 2.58 receivePr->dataRetFromReq = semReq->msg; 2.59 2.60 //bring both processors back from suspend 2.61 - writePrivQ( sendPr, semEnv->readyVPQs[sendPr->coreAnimatedBy] ); 2.62 - writePrivQ( receivePr, semEnv->readyVPQs[receivePr->coreAnimatedBy] ); 2.63 + resume_procr( sendPr, semEnv ); 2.64 + resume_procr( receivePr, semEnv ); 2.65 2.66 return; 2.67 } 2.68 @@ -246,6 +267,8 @@ 2.69 2.70 receivePr = semReq->receivePr; 2.71 2.72 + DEBUG1(dbgRqstHdlr,"ReceiveType request from processor %d\n",receivePr->procrID) 2.73 + 2.74 key[0] = (int)receivePr->procrID; 2.75 key[1] = (int)(semReq->msgType); 2.76 //key[2] acts as the 0 that terminates the string 2.77 @@ -260,6 +283,7 @@ 2.78 if( waitingReq->reqType == send_type ) 2.79 { //waiting request is a send, so pair it with this receive 2.80 //first, remove the waiting send request from the list in entry 2.81 + 2.82 entry->content = waitingReq->nextReqInHashEntry; 2.83 if( entry->content == NULL ) 2.84 { deleteEntryFromTable( entry->key, commHashTbl ); //frees HashEntry 2.85 @@ -273,8 +297,16 @@ 2.86 sendPr = waitingReq->sendPr; 2.87 VMS__free( waitingReq ); 2.88 2.89 - writePrivQ( sendPr, semEnv->readyVPQs[sendPr->coreAnimatedBy] ); 2.90 - writePrivQ( receivePr, semEnv->readyVPQs[receivePr->coreAnimatedBy] ); 2.91 + #ifdef DETECT_DEPENDENCIES 2.92 + int fromRecordIdx = sendPr->counter_history_array_info->numInArray -1; 2.93 + CounterRecord* fromRecord = sendPr->counter_history[fromRecordIdx]; 2.94 + int toRecordIdx = receivePr->counter_history_array_info->numInArray -1; 2.95 + CounterRecord* toRecord = receivePr->counter_history[toRecordIdx]; 2.96 + addToDynArray((void*)new_dependency(sendPr->procrID,fromRecord->task_position,receivePr->procrID,toRecord->task_position),_VMSMasterEnv->dependenciesInfo); 2.97 + #endif 2.98 + 2.99 + resume_procr( sendPr, semEnv ); 2.100 + resume_procr( receivePr, semEnv ); 2.101 2.102 return; 2.103 } 2.104 @@ -292,6 +324,8 @@ 2.105 HashEntry *entry; 2.106 HashTable *commHashTbl = semEnv->commHashTbl; 2.107 2.108 + DEBUG2(dbgRqstHdlr,"ReceiveFromTo request from processor %d to %d\n",semReq->sendPr->procrID,semReq->receivePr->procrID) 2.109 + 2.110 receivePr = semReq->receivePr; 2.111 sendPr = semReq->sendPr; //for receive from-to, know send procr 2.112 2.113 @@ -321,8 +355,8 @@ 2.114 sendPr = waitingReq->sendPr; 2.115 VMS__free( waitingReq ); 2.116 2.117 - writePrivQ( sendPr, semEnv->readyVPQs[sendPr->coreAnimatedBy] ); 2.118 - writePrivQ( receivePr, semEnv->readyVPQs[receivePr->coreAnimatedBy] ); 2.119 + resume_procr( sendPr, semEnv ); 2.120 + resume_procr( receivePr, semEnv ); 2.121 2.122 return; 2.123 } 2.124 @@ -350,6 +384,8 @@ 2.125 void 2.126 handleMalloc( SSRSemReq *semReq, VirtProcr *requestingPr, SSRSemEnv *semEnv ) 2.127 { void *ptr; 2.128 + 2.129 + DEBUG1(dbgRqstHdlr,"Malloc request from processor %d\n",requestingPr->procrID) 2.130 2.131 ptr = VMS__malloc( semReq->sizeToMalloc ); 2.132 requestingPr->dataRetFromReq = ptr; 2.133 @@ -361,6 +397,7 @@ 2.134 void 2.135 handleFree( SSRSemReq *semReq, VirtProcr *requestingPr, SSRSemEnv *semEnv ) 2.136 { 2.137 + DEBUG1(dbgRqstHdlr,"Free request from processor %d\n",requestingPr->procrID) 2.138 VMS__free( semReq->ptrToFree ); 2.139 resume_procr( requestingPr, semEnv ); 2.140 } 2.141 @@ -398,6 +435,7 @@ 2.142 handleStartFnSingleton( SSRSemReq *semReq, VirtProcr *requestingPr, 2.143 SSRSemEnv *semEnv ) 2.144 { SSRSingleton *singleton; 2.145 + DEBUG1(dbgRqstHdlr,"StartFnSingleton request from processor %d\n",requestingPr->procrID) 2.146 2.147 singleton = &(semEnv->fnSingletons[ semReq->singletonID ]); 2.148 handleStartSingleton_helper( singleton, requestingPr, semEnv ); 2.149 @@ -407,6 +445,7 @@ 2.150 SSRSemEnv *semEnv ) 2.151 { SSRSingleton *singleton; 2.152 2.153 + DEBUG1(dbgRqstHdlr,"StartDataSingleton request from processor %d\n",requestingPr->procrID) 2.154 if( *(semReq->singletonPtrAddr) == NULL ) 2.155 { singleton = VMS__malloc( sizeof(SSRSingleton) ); 2.156 singleton->waitQ = makeVMSPrivQ(); 2.157 @@ -453,6 +492,8 @@ 2.158 { 2.159 SSRSingleton *singleton; 2.160 2.161 + DEBUG1(dbgRqstHdlr,"EndFnSingleton request from processor %d\n",requestingPr->procrID) 2.162 + 2.163 singleton = &(semEnv->fnSingletons[ semReq->singletonID ]); 2.164 handleEndSingleton_helper( singleton, requestingPr, semEnv ); 2.165 } 2.166 @@ -462,6 +503,8 @@ 2.167 { 2.168 SSRSingleton *singleton; 2.169 2.170 + DEBUG1(dbgRqstHdlr,"EndDataSingleton request from processor %d\n",requestingPr->procrID) 2.171 + 2.172 singleton = *(semReq->singletonPtrAddr); 2.173 handleEndSingleton_helper( singleton, requestingPr, semEnv ); 2.174 } 2.175 @@ -473,6 +516,7 @@ 2.176 void 2.177 handleAtomic( SSRSemReq *semReq, VirtProcr *requestingPr, SSRSemEnv *semEnv ) 2.178 { 2.179 + DEBUG1(dbgRqstHdlr,"Atomic request from processor %d\n",requestingPr->procrID) 2.180 semReq->fnToExecInMaster( semReq->dataForFn ); 2.181 resume_procr( requestingPr, semEnv ); 2.182 } 2.183 @@ -497,6 +541,8 @@ 2.184 { SSRSemData *semData; 2.185 TransListElem *nextTransElem; 2.186 2.187 + DEBUG1(dbgRqstHdlr,"TransStart request from processor %d\n",requestingPr->procrID) 2.188 + 2.189 //check ordering of entering transactions is correct 2.190 semData = requestingPr->semanticData; 2.191 if( semData->highestTransEntered > semReq->transID ) 2.192 @@ -549,6 +595,8 @@ 2.193 SSRTrans *transStruc; 2.194 TransListElem *lastTrans; 2.195 2.196 + DEBUG1(dbgRqstHdlr,"TransEnd request from processor %d\n",requestingPr->procrID) 2.197 + 2.198 transStruc = &(semEnv->transactionStrucs[ semReq->transID ]); 2.199 2.200 //make sure transaction ended in same VP as started it.
