# HG changeset patch # User Me # Date 1284215214 25200 # Node ID 458024e9cf92b1b61b6e21c46ec0b2393cf7d598 # Parent 0756230c5134a5f23a4aec476864379316e5cc93 Refactored -- measuring works -- take diff in application code diff -r 0756230c5134 -r 458024e9cf92 src/Application/MeasVMS_MeasureFn/EntryPoint.c --- a/src/Application/MeasVMS_MeasureFn/EntryPoint.c Sat Sep 11 03:22:42 2010 -0700 +++ b/src/Application/MeasVMS_MeasureFn/EntryPoint.c Sat Sep 11 07:26:54 2010 -0700 @@ -8,6 +8,7 @@ #include "MeasVMS_MeasureFn.h" +#include @@ -26,14 +27,18 @@ * */ void -measureVMS( Histogram **suspHistAddr, Histogram **masterHistAddr ) +measureVMS() { - PairOfHistAddresses *histCarrier = malloc( sizeof( PairOfHistAddresses )); + HistCarrier *histCarrier = malloc( sizeof( HistCarrier )); - histCarrier->suspHistAddr = suspHistAddr; - histCarrier->masterHistAddr = masterHistAddr; + histCarrier->suspHist = makeHistogram( 25, 110, 160 ); + histCarrier->masterHist = makeHistogram( 25, 500, 800 ); MeasVMS__create_seed_procr_and_do_work( &measSuspendFn, histCarrier ); - //return measurement values via side-effect + printf( "\n suspend histogram:\n" ); + printHist( histCarrier->suspHist ); + + printf( "\n master histogram:\n" ); + printHist( histCarrier->masterHist ); } diff -r 0756230c5134 -r 458024e9cf92 src/Application/MeasVMS_MeasureFn/MeasVMS_MeasureFn.h --- a/src/Application/MeasVMS_MeasureFn/MeasVMS_MeasureFn.h Sat Sep 11 03:22:42 2010 -0700 +++ b/src/Application/MeasVMS_MeasureFn/MeasVMS_MeasureFn.h Sat Sep 11 07:26:54 2010 -0700 @@ -13,7 +13,7 @@ //============================== Entry Point ================================ void -measureVMS( Histogram **suspHistAddr, Histogram **masterHistAddr ); +measureVMS(); //============================== Structures =============================== diff -r 0756230c5134 -r 458024e9cf92 src/Application/MeasVMS_MeasureFn/seed_Pr.c --- a/src/Application/MeasVMS_MeasureFn/seed_Pr.c Sat Sep 11 03:22:42 2010 -0700 +++ b/src/Application/MeasVMS_MeasureFn/seed_Pr.c Sat Sep 11 07:26:54 2010 -0700 @@ -26,10 +26,11 @@ void measSuspendFn( void *_params, VirtProcr *animatingPr ) { unsigned int diff; - Histogram * hist; + HistCarrier *histCarrier; + + histCarrier = (HistCarrier *)_params; - hist = (Histogram *)_params; - + //Initial suspend, to get request handler into proper pattern VMS__suspend_procr( animatingPr ); while( TRUE ) @@ -38,9 +39,23 @@ // puts two copies of reference to animatingPr into queue, so // resumes immediately after suspend, with no MasterVP between VMS__suspend_procr( animatingPr ); + + //Take difference between the pre-suspend and post-suspend times + // and do sanity check to see if rollover happened between + diff = animatingPr->postSuspTSCLow - animatingPr->preSuspTSCLow; + if( diff > 1000000 ) diff = 0; + addToHist( diff, histCarrier->suspHist ); //This suspend just lets request handler put two more into queue // Notice, there is no request created, handler knows what to do VMS__suspend_procr( animatingPr ); + + //Master will have run at this point, so save master time into hist + diff = _VMSMasterEnv->masterVPs[0]->endMasterTSCLow - + _VMSMasterEnv->masterVPs[0]->startMasterTSCLow; + if( diff > 1000000 ) diff = 0; + addToHist( diff, histCarrier->masterHist ); } + + //return resulting histograms by side-effect } diff -r 0756230c5134 -r 458024e9cf92 src/Application/main.c --- a/src/Application/main.c Sat Sep 11 03:22:42 2010 -0700 +++ b/src/Application/main.c Sat Sep 11 07:26:54 2010 -0700 @@ -16,16 +16,9 @@ * */ int main( int argc, char **argv ) - { - Histogram *suspHist, *masterHist; - - measureVMS( &suspHist, &masterHist ); - - printf("\ncore loop hist\n"); - printHist( suspHist ); - - printf("\nmaster hist\n"); - printHist( masterHist ); + { + + measureVMS(); exit(0); //cleans up }