comparison MasterLoop.c @ 215:10a72bcedbf0

fixed include paths, and various minor fixes, while updating SSR to use this brch
author Some Random Person <seanhalle@yahoo.com>
date Fri, 09 Mar 2012 22:30:26 -0800
parents 0c83ea8adefc
children 712218cdc4ba
comparison
equal deleted inserted replaced
59:fb4f1317b78c 60:548ac2b6791d
81 Sched_Assigner slaveAssigner; 81 Sched_Assigner slaveAssigner;
82 RequestHandler requestHandler; 82 RequestHandler requestHandler;
83 void *semanticEnv; 83 void *semanticEnv;
84 84
85 int32 thisCoresIdx; 85 int32 thisCoresIdx;
86 SlaveVP *masterVP; 86 SlaveVP *masterVP;
87 volatile SlaveVP *volatileMasterVP; 87 volatile SlaveVP *volatileMasterVP;
88 88
89 volatileMasterVP = animatingSlv; 89 volatileMasterVP = animatingSlv;
90 masterVP = (SlaveVP*)volatileMasterVP; //used to force re-define after jmp 90 masterVP = (SlaveVP*)volatileMasterVP; //used to force re-define after jmp
91 91
116 thisCoresIdx = masterVP->coreAnimatedBy; 116 thisCoresIdx = masterVP->coreAnimatedBy;
117 readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx]; 117 readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx];
118 schedSlots = masterEnv->allSchedSlots[thisCoresIdx]; 118 schedSlots = masterEnv->allSchedSlots[thisCoresIdx];
119 119
120 requestHandler = masterEnv->requestHandler; 120 requestHandler = masterEnv->requestHandler;
121 slaveAssigner = masterEnv->slaveAssigner; 121 slaveAssigner = masterEnv->slaveAssigner;
122 semanticEnv = masterEnv->semanticEnv; 122 semanticEnv = masterEnv->semanticEnv;
123 123
124 124
125 //Poll each slot's Done flag 125 //Poll each slot's Done flag
126 numSlotsFilled = 0; 126 numSlotsFilled = 0;
131 if( currSlot->workIsDone ) 131 if( currSlot->workIsDone )
132 { 132 {
133 currSlot->workIsDone = FALSE; 133 currSlot->workIsDone = FALSE;
134 currSlot->needsSlaveAssigned = TRUE; 134 currSlot->needsSlaveAssigned = TRUE;
135 135
136 //process requests from slave to master 136 MEAS__startReqHdlr;
137 //====================== MEASUREMENT STUFF =================== 137
138 #ifdef MEAS__TURN_ON_PLUGIN_MEAS 138 //process the requests made by the slave (held inside slave struc)
139 int32 startStamp1, endStamp1;
140 saveLowTimeStampCountInto( startStamp1 );
141 #endif
142 //============================================================
143 (*requestHandler)( currSlot->slaveAssignedToSlot, semanticEnv ); 139 (*requestHandler)( currSlot->slaveAssignedToSlot, semanticEnv );
144 //====================== MEASUREMENT STUFF =================== 140
145 #ifdef MEAS__TURN_ON_PLUGIN_MEAS 141 MEAS__endReqHdlr;
146 saveLowTimeStampCountInto( endStamp1 );
147 addIntervalToHist( startStamp1, endStamp1,
148 _VMSMasterEnv->reqHdlrLowTimeHist );
149 addIntervalToHist( startStamp1, endStamp1,
150 _VMSMasterEnv->reqHdlrHighTimeHist );
151 #endif
152 //============================================================
153 } 142 }
154 if( currSlot->needsSlaveAssigned ) 143 if( currSlot->needsSlaveAssigned )
155 { //give slot a new Slv 144 { //give slot a new Slv
156 schedSlaveVP = 145 schedSlaveVP =
157 (*slaveAssigner)( semanticEnv, thisCoresIdx ); 146 (*slaveAssigner)( semanticEnv, thisCoresIdx );
158 147
159 if( schedSlaveVP != NULL ) 148 if( schedSlaveVP != NULL )
160 { currSlot->slaveAssignedToSlot = schedSlaveVP; 149 { currSlot->slaveAssignedToSlot = schedSlaveVP;
161 schedSlaveVP->schedSlot = currSlot; 150 schedSlaveVP->schedSlot = currSlot;
162 currSlot->needsSlaveAssigned = FALSE; 151 currSlot->needsSlaveAssigned = FALSE;
163 numSlotsFilled += 1; 152 numSlotsFilled += 1;
164
165 writeVMSQ( schedSlaveVP, readyToAnimateQ );
166 } 153 }
167 } 154 }
168 } 155 }
169 156
170 157
171 #ifdef USE_WORK_STEALING 158 #ifdef SYS__TURN_ON_WORK_STEALING
172 //If no slots filled, means no more work, look for work to steal. 159 //If no slots filled, means no more work, look for work to steal.
173 if( numSlotsFilled == 0 ) 160 if( numSlotsFilled == 0 )
174 { gateProtected_stealWorkInto( currSlot, readyToAnimateQ, masterVP ); 161 { gateProtected_stealWorkInto( currSlot, readyToAnimateQ, masterVP );
175 } 162 }
176 #endif 163 #endif