Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
diff VMS.c @ 47:72373405c816
Adding TSC normalization -- still in progress, not working
| author | Me |
|---|---|
| date | Sat, 16 Oct 2010 04:11:15 -0700 |
| parents | cf3e9238aeb0 |
| children | 054006c26b92 |
line diff
1.1 --- a/VMS.c Thu Oct 14 17:07:23 2010 -0700 1.2 +++ b/VMS.c Sat Oct 16 04:11:15 2010 -0700 1.3 @@ -79,7 +79,7 @@ 1.4 void 1.5 create_masterEnv() 1.6 { MasterEnv *masterEnv; 1.7 - SRSWQueueStruc **readyToAnimateQs; 1.8 + VMSQueueStruc **readyToAnimateQs; 1.9 int coreIdx; 1.10 VirtProcr **masterVPs; 1.11 SchedSlot ***allSchedSlots; //ptr to array of ptrs 1.12 @@ -93,7 +93,7 @@ 1.13 // masterEnv->coreLoopEndPt = ; 1.14 1.15 //Make a readyToAnimateQ for each core loop 1.16 - readyToAnimateQs = malloc( NUM_CORES * sizeof(SRSWQueueStruc *) ); 1.17 + readyToAnimateQs = malloc( NUM_CORES * sizeof(VMSQueueStruc *) ); 1.18 masterVPs = malloc( NUM_CORES * sizeof(VirtProcr *) ); 1.19 1.20 //One array for each core, 3 in array, core's masterVP scheds all 1.21 @@ -196,7 +196,22 @@ 1.22 { 1.23 //======================================================================== 1.24 // Create the Threads 1.25 - int coreIdx, retCode; 1.26 + int coreIdx, retCode, i; 1.27 + 1.28 + //create the arrays used to measure TSC offsets between cores 1.29 + pongNums = malloc( NUM_CORES * sizeof( int ) ); 1.30 + pingTimes = malloc( NUM_CORES * NUM_TSC_ROUND_TRIPS * sizeof( TSCount ) ); 1.31 + pongTimes = malloc( NUM_CORES * NUM_TSC_ROUND_TRIPS * sizeof( TSCount ) ); 1.32 + 1.33 + for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) 1.34 + { 1.35 + pongNums[ coreIdx ] = 0; 1.36 + for( i = 0; i < NUM_TSC_ROUND_TRIPS; i++ ) 1.37 + { 1.38 + pingTimes[ coreIdx * NUM_TSC_ROUND_TRIPS + i ] = (TSCount) 0; 1.39 + pingTimes[ coreIdx * NUM_TSC_ROUND_TRIPS + i ] = (TSCount) 0; 1.40 + } 1.41 + } 1.42 1.43 //Need the threads to be created suspended, and wait for a signal 1.44 // before proceeding -- gives time after creating to initialize other 1.45 @@ -230,7 +245,7 @@ 1.46 unsigned long long count = 0, freq = 0; 1.47 double runTime; 1.48 1.49 - startCount = getTSCount(); 1.50 + startCount = getTSC(); 1.51 1.52 //tell the core loop threads that setup is complete 1.53 //get lock, to lock out any threads still starting up -- they'll see 1.54 @@ -253,7 +268,7 @@ 1.55 // the Master env and rest of VMS locations 1.56 1.57 1.58 - endCount = getTSCount(); 1.59 + endCount = getTSC(); 1.60 count = endCount - startCount; 1.61 1.62 runTime = (double)count / (double)TSCOUNT_FREQ; 1.63 @@ -303,8 +318,7 @@ 1.64 // for 2 params + return addr. Return addr (NULL) is in loc pointed to 1.65 // by stackPtr, initData at stackPtr + 4 bytes, animatingPr just above 1.66 stackLocs = malloc( VIRT_PROCR_STACK_SIZE ); 1.67 - if(stackLocs == 0) 1.68 - {perror("malloc stack"); exit(1);} 1.69 + if(stackLocs == 0) {perror("error: malloc stack"); exit(1);} 1.70 newPr->startOfStack = stackLocs; 1.71 stackPtr = ( (char *)stackLocs + VIRT_PROCR_STACK_SIZE - 0x10 ); 1.72 //setup __cdecl on stack -- coreloop will switch to stackPtr before jmp 1.73 @@ -652,7 +666,7 @@ 1.74 void 1.75 VMS__cleanup_after_shutdown() 1.76 { 1.77 - SRSWQueueStruc **readyToAnimateQs; 1.78 + VMSQueueStruc **readyToAnimateQs; 1.79 int coreIdx; 1.80 VirtProcr **masterVPs; 1.81 SchedSlot ***allSchedSlots; //ptr to array of ptrs 1.82 @@ -680,7 +694,7 @@ 1.83 1.84 //=========================================================================== 1.85 1.86 -inline TSCount getTSCount() 1.87 +inline TSCount getTSC() 1.88 { unsigned int low, high; 1.89 TSCount out; 1.90
