comparison MasterLoop.c @ 38:17d20e5cf924

measures coreloop and masterVP times
author Me
date Tue, 07 Sep 2010 18:40:57 -0700
parents e69579a0e797
children cf3e9238aeb0
comparison
equal deleted inserted replaced
9:73e221819099 10:3c434c85ba8c
1 /* 1 /*
2 * Copyright 2010 OpenSourceCodeStewardshipFoundation 2 * Copyright 2010 OpenSourceStewardshipFoundation
3 * 3 *
4 * Licensed under BSD 4 * Licensed under BSD
5 */ 5 */
6 6
7 7
96 // version of that MasterVP can get animated on a different core. 96 // version of that MasterVP can get animated on a different core.
97 //Also got rid of the busy-wait. 97 //Also got rid of the busy-wait.
98 98
99 99
100 masterLoopStartPt: 100 masterLoopStartPt:
101 //============================= MEASUREMENT STUFF ========================
102 #ifdef MEAS__TIME_MASTER
103 //Total Master time includes one coreloop time -- just assume the core
104 // loop time is same for Master as for AppVPs, even though it will be
105 // smaller due to high predictability of the jumps.
106 saveLowTimeStampCountInto( masterPr->startMasterTSCLow );
107 #endif
108 //========================================================================
101 109
102 masterEnv = _VMSMasterEnv; 110 masterEnv = _VMSMasterEnv;
103 111
104 //TODO: check that compiles so that always re-define from frame-storage 112 //TODO: check that compiles so that always re-define from frame-storage
105 masterPr = volatileMasterPr; //just to make sure after jmp 113 masterPr = volatileMasterPr; //just to make sure after jmp
154 162
155 jmpPt = _VMSMasterEnv->coreLoopStartPt; 163 jmpPt = _VMSMasterEnv->coreLoopStartPt;
156 coreLoopFramePtr = masterPr->coreLoopFramePtr;//need this only 164 coreLoopFramePtr = masterPr->coreLoopFramePtr;//need this only
157 coreLoopStackPtr = masterPr->coreLoopStackPtr;//shouldn't need -- safety 165 coreLoopStackPtr = masterPr->coreLoopStackPtr;//shouldn't need -- safety
158 166
167 #ifdef MEAS__TIME_MASTER
168 saveLowTimeStampCountInto( masterPr->endMasterTSCLow );
169 int diff = masterPr->endMasterTSCLow - masterPr->startMasterTSCLow;
170 if( diff > 1000000 ) diff = 0;
171 addToHist( diff, masterEnv->measMasterHist );
172 #endif
173
159 asm volatile("movl %0, %%eax; \ 174 asm volatile("movl %0, %%eax; \
160 movl %%esp, (%%eax); \ 175 movl %%esp, (%%eax); \
161 movl %1, %%eax; \ 176 movl %1, %%eax; \
162 movl %%ebp, (%%eax); \ 177 movl %%ebp, (%%eax); \
163 movl %2, %%ebx; \ 178 movl %2, %%ebx; \
165 movl %4, %%esp; \ 180 movl %4, %%esp; \
166 movl %5, %%ebp; \ 181 movl %5, %%ebp; \
167 movl $0x0, (%%ebx); \ 182 movl $0x0, (%%ebx); \
168 jmp %%eax;" \ 183 jmp %%eax;" \
169 /* outputs */ : "=g" (stackPtrAddr), "=g" (framePtrAddr), \ 184 /* outputs */ : "=g" (stackPtrAddr), "=g" (framePtrAddr), \
170 "=g"(masterLockAddr) \ 185 "=g"(masterLockAddr) \
171 /* inputs */ : "g" (jmpPt), "g"(coreLoopStackPtr), "g"(coreLoopFramePtr)\ 186 /* inputs */ : "g" (jmpPt), "g"(coreLoopStackPtr), "g"(coreLoopFramePtr)\
172 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi" \ 187 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi" \
173 );//can probably make clobber list empty -- but safe for now 188 );//can probably make clobber list empty -- but safe for now
174 } 189 }
175 190