Mercurial > cgi-bin > hgwebdir.cgi > PR > Applications > MeasVMS > VMS__Susp_and_Master__Meas
changeset 0:0756230c5134
Initial add -- working app to measure suspend and master times
However, has weird suspend time histogram.. needs tweaking.
Will take update of the histogram out of core loop and put into app
| author | Me |
|---|---|
| date | Sat, 11 Sep 2010 03:22:42 -0700 |
| parents | |
| children | 458024e9cf92 |
| 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, 141 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/Application/MeasVMS_MeasureFn/EntryPoint.c Sat Sep 11 03:22:42 2010 -0700 1.3 @@ -0,0 +1,39 @@ 1.4 +/* 1.5 + * Copyright 2009 OpenSourceStewardshipFoundation.org 1.6 + * Licensed under GNU General Public License version 2 1.7 + * 1.8 + * Author: seanhalle@yahoo.com 1.9 + * 1.10 + */ 1.11 + 1.12 + 1.13 +#include "MeasVMS_MeasureFn.h" 1.14 + 1.15 + 1.16 + 1.17 +/*Every MeasVMS system has an "entry point" function that creates the first 1.18 + * processor, which starts the chain of creating more processors.. 1.19 + * eventually all of the processors will dissipate themselves, and 1.20 + * return. 1.21 + * 1.22 + *This entry-point function follows the same pattern as all entry-point 1.23 + * functions do: 1.24 + *1) it creates the params for the seed processor, from the 1.25 + * parameters passed into the entry-point function 1.26 + *2) it calls MeasVMS__create_seed_procr_and_do_work 1.27 + *3) it gets the return value from the params struc, frees the params struc, 1.28 + * and returns the value from the function 1.29 + * 1.30 + */ 1.31 +void 1.32 +measureVMS( Histogram **suspHistAddr, Histogram **masterHistAddr ) 1.33 + { 1.34 + PairOfHistAddresses *histCarrier = malloc( sizeof( PairOfHistAddresses )); 1.35 + 1.36 + histCarrier->suspHistAddr = suspHistAddr; 1.37 + histCarrier->masterHistAddr = masterHistAddr; 1.38 + 1.39 + MeasVMS__create_seed_procr_and_do_work( &measSuspendFn, histCarrier ); 1.40 + 1.41 + //return measurement values via side-effect 1.42 + }
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/src/Application/MeasVMS_MeasureFn/MeasVMS_MeasureFn.h Sat Sep 11 03:22:42 2010 -0700 2.3 @@ -0,0 +1,25 @@ 2.4 +/* 2.5 + * Copyright Oct 24, 2009 OpenSourceStewardshipFoundation.org 2.6 + * Licensed under GNU General Public License version 2 2.7 + */ 2.8 + 2.9 +#ifndef _MeasVMS_MATRIX_MULT_H_ 2.10 +#define _MeasVMS_MATRIX_MULT_H_ 2.11 + 2.12 +#include <stdio.h> 2.13 + 2.14 +#include "../../MeasVMS_lib/MeasVMS.h" 2.15 +#include "../../MeasVMS_lib/VMS/Histogram/Histogram.h" 2.16 + 2.17 +//============================== Entry Point ================================ 2.18 +void 2.19 +measureVMS( Histogram **suspHistAddr, Histogram **masterHistAddr ); 2.20 + 2.21 +//============================== Structures =============================== 2.22 + 2.23 +//=========================== Processor Functions =========================== 2.24 + 2.25 +void measSuspendFn( void *_params, VirtProcr *animatingPr ); 2.26 + 2.27 + 2.28 +#endif /*_MeasVMS_MATRIX_MULT_H_*/
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/src/Application/MeasVMS_MeasureFn/seed_Pr.c Sat Sep 11 03:22:42 2010 -0700 3.3 @@ -0,0 +1,46 @@ 3.4 +/* 3.5 + * Copyright 2009 OpenSourceStewardshipFoundation.org 3.6 + * Licensed under GNU General Public License version 2 3.7 + * 3.8 + * Author: seanhalle@yahoo.com 3.9 + * 3.10 + */ 3.11 + 3.12 + 3.13 +#include "MeasVMS_MeasureFn.h" 3.14 +#include "../../MeasVMS_lib/VMS/Histogram/Histogram.h" 3.15 + 3.16 +/*The request handler puts this exact same processor into 3.17 + * the queue twice. The time calculated by first one is overwritten by 3.18 + * the time calculated by second -- the request handler adds that to the 3.19 + * histogram. 3.20 + *Background: the VMS__suspend_procr has been modified to do RDTSC before 3.21 + * suspend and again after resume. It saves the values into the VirtProcr 3.22 + * data-struc. This appVP breaks the abstraction by directly accessing 3.23 + * the values in the VirtProcr data-struct. 3.24 + * 3.25 + *NOTE: also breaks the rules by never dissipating -- the request handler 3.26 + * has to decide when to destroy the VPs animating copies of this function. 3.27 + * 3.28 + */ 3.29 +void measSuspendFn( void *_params, VirtProcr *animatingPr ) 3.30 + { 3.31 + unsigned int diff; 3.32 + Histogram * hist; 3.33 + 3.34 + hist = (Histogram *)_params; 3.35 + 3.36 + VMS__suspend_procr( animatingPr ); 3.37 + 3.38 + while( TRUE ) 3.39 + { 3.40 + //This suspend sets the values used in calcs -- request handler 3.41 + // puts two copies of reference to animatingPr into queue, so 3.42 + // resumes immediately after suspend, with no MasterVP between 3.43 + VMS__suspend_procr( animatingPr ); 3.44 + 3.45 + //This suspend just lets request handler put two more into queue 3.46 + // Notice, there is no request created, handler knows what to do 3.47 + VMS__suspend_procr( animatingPr ); 3.48 + } 3.49 + }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/src/Application/main.c Sat Sep 11 03:22:42 2010 -0700 4.3 @@ -0,0 +1,31 @@ 4.4 +/* 4.5 + * Copyright Oct 24, 2009 OpenSourceStewardshipFoundation.org 4.6 + * Licensed under GNU General Public License version 2 4.7 + * 4.8 + * author seanhalle@yahoo.com 4.9 + */ 4.10 + 4.11 +#include <malloc.h> 4.12 +#include <stdlib.h> 4.13 + 4.14 +#include "../MeasVMS_lib/VMS/Histogram/Histogram.h" 4.15 +#include "MeasVMS_MeasureFn/MeasVMS_MeasureFn.h" 4.16 + 4.17 +/** 4.18 + *Matrix multiply program written using VMS_HW piggy-back language 4.19 + * 4.20 + */ 4.21 +int main( int argc, char **argv ) 4.22 + { 4.23 + Histogram *suspHist, *masterHist; 4.24 + 4.25 + measureVMS( &suspHist, &masterHist ); 4.26 + 4.27 + printf("\ncore loop hist\n"); 4.28 + printHist( suspHist ); 4.29 + 4.30 + printf("\nmaster hist\n"); 4.31 + printHist( masterHist ); 4.32 + 4.33 + exit(0); //cleans up 4.34 + }
