Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > MeasVMS > VMS__Susp_and_Master__Meas
changeset 1:458024e9cf92
Refactored -- measuring works -- take diff in application code
| author | Me |
|---|---|
| date | Sat, 11 Sep 2010 07:26:54 -0700 |
| parents | 0756230c5134 |
| children | 1f58fc0180e4 |
| files | src/Application/MeasVMS_MeasureFn/EntryPoint.c src/Application/MeasVMS_MeasureFn/MeasVMS_MeasureFn.h src/Application/MeasVMS_MeasureFn/seed_Pr.c src/Application/main.c |
| diffstat | 4 files changed, 32 insertions(+), 19 deletions(-) [+] |
line diff
1.1 --- a/src/Application/MeasVMS_MeasureFn/EntryPoint.c Sat Sep 11 03:22:42 2010 -0700 1.2 +++ b/src/Application/MeasVMS_MeasureFn/EntryPoint.c Sat Sep 11 07:26:54 2010 -0700 1.3 @@ -8,6 +8,7 @@ 1.4 1.5 1.6 #include "MeasVMS_MeasureFn.h" 1.7 +#include <malloc.h> 1.8 1.9 1.10 1.11 @@ -26,14 +27,18 @@ 1.12 * 1.13 */ 1.14 void 1.15 -measureVMS( Histogram **suspHistAddr, Histogram **masterHistAddr ) 1.16 +measureVMS() 1.17 { 1.18 - PairOfHistAddresses *histCarrier = malloc( sizeof( PairOfHistAddresses )); 1.19 + HistCarrier *histCarrier = malloc( sizeof( HistCarrier )); 1.20 1.21 - histCarrier->suspHistAddr = suspHistAddr; 1.22 - histCarrier->masterHistAddr = masterHistAddr; 1.23 + histCarrier->suspHist = makeHistogram( 25, 110, 160 ); 1.24 + histCarrier->masterHist = makeHistogram( 25, 500, 800 ); 1.25 1.26 MeasVMS__create_seed_procr_and_do_work( &measSuspendFn, histCarrier ); 1.27 1.28 - //return measurement values via side-effect 1.29 + printf( "\n suspend histogram:\n" ); 1.30 + printHist( histCarrier->suspHist ); 1.31 + 1.32 + printf( "\n master histogram:\n" ); 1.33 + printHist( histCarrier->masterHist ); 1.34 }
2.1 --- a/src/Application/MeasVMS_MeasureFn/MeasVMS_MeasureFn.h Sat Sep 11 03:22:42 2010 -0700 2.2 +++ b/src/Application/MeasVMS_MeasureFn/MeasVMS_MeasureFn.h Sat Sep 11 07:26:54 2010 -0700 2.3 @@ -13,7 +13,7 @@ 2.4 2.5 //============================== Entry Point ================================ 2.6 void 2.7 -measureVMS( Histogram **suspHistAddr, Histogram **masterHistAddr ); 2.8 +measureVMS(); 2.9 2.10 //============================== Structures =============================== 2.11
3.1 --- a/src/Application/MeasVMS_MeasureFn/seed_Pr.c Sat Sep 11 03:22:42 2010 -0700 3.2 +++ b/src/Application/MeasVMS_MeasureFn/seed_Pr.c Sat Sep 11 07:26:54 2010 -0700 3.3 @@ -26,10 +26,11 @@ 3.4 void measSuspendFn( void *_params, VirtProcr *animatingPr ) 3.5 { 3.6 unsigned int diff; 3.7 - Histogram * hist; 3.8 + HistCarrier *histCarrier; 3.9 + 3.10 + histCarrier = (HistCarrier *)_params; 3.11 3.12 - hist = (Histogram *)_params; 3.13 - 3.14 + //Initial suspend, to get request handler into proper pattern 3.15 VMS__suspend_procr( animatingPr ); 3.16 3.17 while( TRUE ) 3.18 @@ -38,9 +39,23 @@ 3.19 // puts two copies of reference to animatingPr into queue, so 3.20 // resumes immediately after suspend, with no MasterVP between 3.21 VMS__suspend_procr( animatingPr ); 3.22 + 3.23 + //Take difference between the pre-suspend and post-suspend times 3.24 + // and do sanity check to see if rollover happened between 3.25 + diff = animatingPr->postSuspTSCLow - animatingPr->preSuspTSCLow; 3.26 + if( diff > 1000000 ) diff = 0; 3.27 + addToHist( diff, histCarrier->suspHist ); 3.28 3.29 //This suspend just lets request handler put two more into queue 3.30 // Notice, there is no request created, handler knows what to do 3.31 VMS__suspend_procr( animatingPr ); 3.32 + 3.33 + //Master will have run at this point, so save master time into hist 3.34 + diff = _VMSMasterEnv->masterVPs[0]->endMasterTSCLow - 3.35 + _VMSMasterEnv->masterVPs[0]->startMasterTSCLow; 3.36 + if( diff > 1000000 ) diff = 0; 3.37 + addToHist( diff, histCarrier->masterHist ); 3.38 } 3.39 + 3.40 + //return resulting histograms by side-effect 3.41 }
4.1 --- a/src/Application/main.c Sat Sep 11 03:22:42 2010 -0700 4.2 +++ b/src/Application/main.c Sat Sep 11 07:26:54 2010 -0700 4.3 @@ -16,16 +16,9 @@ 4.4 * 4.5 */ 4.6 int main( int argc, char **argv ) 4.7 - { 4.8 - Histogram *suspHist, *masterHist; 4.9 - 4.10 - measureVMS( &suspHist, &masterHist ); 4.11 - 4.12 - printf("\ncore loop hist\n"); 4.13 - printHist( suspHist ); 4.14 - 4.15 - printf("\nmaster hist\n"); 4.16 - printHist( masterHist ); 4.17 + { 4.18 + 4.19 + measureVMS(); 4.20 4.21 exit(0); //cleans up 4.22 }
