comparison MasterLoop.c @ 174:c3f458403cd6

Always allocate more than 256 byte, measurements removed in master loop, aligned slots
author Merten Sach <msach@mailbox.tu-berlin.de>
date Tue, 20 Dec 2011 16:50:21 +0100
parents d1dd9e6ee72c
children 91d0d2e06719
comparison
equal deleted inserted replaced
45:98465da51254 46:5a7513d1bdea
93 //====================== Measurement ===================== 93 //====================== Measurement =====================
94 TSCountLowHigh endMaster; 94 TSCountLowHigh endMaster;
95 uint64 numCycles; 95 uint64 numCycles;
96 //========================================================== 96 //==========================================================
97 97
98 //masterLoopStartPt: 98 masterEnv = (MasterEnv*)_VMSMasterEnv;
99
100 masterVP = (VirtProcr*)volatilemasterVP; //just to make sure after jmp
101 thisCoresIdx = masterVP->coreAnimatedBy;
102 readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx];
103 schedSlots = masterEnv->allSchedSlots[thisCoresIdx];
104
105 requestHandler = masterEnv->requestHandler;
106 slaveScheduler = masterEnv->slaveScheduler;
107 semanticEnv = masterEnv->semanticEnv;
108
109 //masterLoopStartPt:
99 while(1){ //switch to core_loop and back to here is at end of loop 110 while(1){ //switch to core_loop and back to here is at end of loop
100 111
101 //============================= MEASUREMENT STUFF ======================= 112 //============================= MEASUREMENT STUFF =======================
102 #ifdef MEAS__TIME_MASTER 113 #ifdef MEAS__TIME_MASTER
103 //Total Master time includes one coreloop time -- just assume the core 114 //Total Master time includes one coreloop time -- just assume the core
105 // smaller due to higher predictability of the fixed jmp. 116 // smaller due to higher predictability of the fixed jmp.
106 saveLowTimeStampCountInto( masterVP->startMasterTSCLow ); 117 saveLowTimeStampCountInto( masterVP->startMasterTSCLow );
107 #endif 118 #endif
108 //======================================================================= 119 //=======================================================================
109 120
110 masterEnv = (MasterEnv*)_VMSMasterEnv;
111
112 //GCC may optimize so doesn't always re-define from frame-storage
113 masterVP = (VirtProcr*)volatilemasterVP; //just to make sure after jmp
114 thisCoresIdx = masterVP->coreAnimatedBy;
115 readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx];
116 schedSlots = masterEnv->allSchedSlots[thisCoresIdx];
117
118 requestHandler = masterEnv->requestHandler;
119 slaveScheduler = masterEnv->slaveScheduler;
120 semanticEnv = masterEnv->semanticEnv;
121
122 121
123 //Poll each slot's Done flag 122 //Poll each slot's Done flag
124 numSlotsFilled = 0; 123 numSlotsFilled = 0;
124 /*
125 Meas_startMasterLoop 125 Meas_startMasterLoop
126 */
126 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++) 127 for( slotIdx = 0; slotIdx < NUM_SCHED_SLOTS; slotIdx++)
127 { 128 {
128 currSlot = schedSlots[ slotIdx ]; 129 currSlot = schedSlots[ slotIdx ];
129 130
130 if( currSlot->workIsDone ) 131 if( currSlot->workIsDone )
131 { 132 {
132 currSlot->workIsDone = FALSE; 133 currSlot->workIsDone = FALSE;
133 currSlot->needsProcrAssigned = TRUE; 134 currSlot->needsProcrAssigned = TRUE;
134 135
135 //process requests from slave to master 136 //process requests from slave to master
137 /*
136 Meas_startReqHdlr 138 Meas_startReqHdlr
139 */
137 (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv ); 140 (*requestHandler)( currSlot->procrAssignedToSlot, semanticEnv );
141 /*
138 Meas_endReqHdlr 142 Meas_endReqHdlr
143 */
139 } 144 }
140 if( currSlot->needsProcrAssigned ) 145 if( currSlot->needsProcrAssigned )
141 { //give slot a new virt procr 146 { //give slot a new virt procr
142 schedVirtPr = 147 schedVirtPr =
143 (*slaveScheduler)( semanticEnv, thisCoresIdx ); 148 (*slaveScheduler)( semanticEnv, thisCoresIdx );
150 155
151 writeVMSQ( schedVirtPr, readyToAnimateQ ); 156 writeVMSQ( schedVirtPr, readyToAnimateQ );
152 } 157 }
153 } 158 }
154 } 159 }
160 /*
155 Meas_endMasterLoop 161 Meas_endMasterLoop
162 */
156 163
157 #ifdef USE_WORK_STEALING 164 #ifdef USE_WORK_STEALING
158 //If no slots filled, means no more work, look for work to steal. 165 //If no slots filled, means no more work, look for work to steal.
159 if( numSlotsFilled == 0 ) 166 if( numSlotsFilled == 0 )
160 { gateProtected_stealWorkInto( currSlot, readyToAnimateQ, masterVP ); 167 { gateProtected_stealWorkInto( currSlot, readyToAnimateQ, masterVP );