# HG changeset patch # User Me # Date 1288500835 25200 # Node ID f59cfa31a579a9423c2a1b38cc39dc633519d35c # Parent 2952d337d6f33d222b98b301856826cee76cbb31 fixed up probes just a bit diff -r 2952d337d6f3 -r f59cfa31a579 CoreLoop.c --- a/CoreLoop.c Sat Oct 30 20:55:39 2010 -0700 +++ b/CoreLoop.c Sat Oct 30 21:53:55 2010 -0700 @@ -109,7 +109,9 @@ // jumps back to coreLoops's startPt currPr = _VMSMasterEnv->masterVPs[thisCoresIdx]; if( _VMSMasterEnv->numMasterInARow[thisCoresIdx] > 10000 ) - printf("10000 back to back MasterVP\n"); + { //printf("10000 back to back MasterVP\n"); + pthread_yield(); + } _VMSMasterEnv->numMasterInARow[thisCoresIdx] += 1; break; //end while -- have a VP to animate now } diff -r 2952d337d6f3 -r f59cfa31a579 VMS.c --- a/VMS.c Sat Oct 30 20:55:39 2010 -0700 +++ b/VMS.c Sat Oct 30 21:53:55 2010 -0700 @@ -549,8 +549,14 @@ * language -- but it's also a semantic thing that's triggered from and used * in the application.. so it crosses abstractions.. so, need some special * pattern here for handling such requests. + * Doing this just like it were a second language sharing VMS-core. + * * This is called from the language's request handler when it sees a request * of type VMSSemReq + * + * TODO: Later change this, to give probes their own separate plugin & have + * VMS-core steer the request to appropriate plugin + * Do the same for OS calls -- look later at it.. */ void inline VMS__handle_VMSSemReq( VMSReqst *req, VirtProcr *requestingPr, void *semEnv, diff -r 2952d337d6f3 -r f59cfa31a579 VMS.h --- a/VMS.h Sat Oct 30 20:55:39 2010 -0700 +++ b/VMS.h Sat Oct 30 21:53:55 2010 -0700 @@ -27,6 +27,11 @@ // has only a single thread and animates VPs one at a time //#define SEQUENTIAL + //turns on the probe-instrumentation in the application -- when not + // defined, the calls to the probe functions turn into comments +#define STATS__ENABLE_PROBES + + #define PRINT_DEBUG(msg)// printf(msg); fflush(stdin); #define PRINT1_DEBUG(msg, param) //printf(msg, param); fflush(stdin); #define PRINT2_DEBUG(msg, p1, p2) //printf(msg, p1, p2); fflush(stdin); @@ -279,6 +284,9 @@ void VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr ); +inline void +VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr ); + void VMS__free_request( VMSReqst *req ); @@ -286,22 +294,22 @@ VMS__remove_and_free_top_request( VirtProcr *reqstingPr ); VMSReqst * -VMS__take_top_request_from( VirtProcr *reqstingPr ); - -VMSReqst * VMS__take_next_request_out_of( VirtProcr *procrWithReq ); inline void * VMS__take_sem_reqst_from( VMSReqst *req ); - -inline int -VMS__isSemanticReqst( VMSReqst *req ); - -inline int -VMS__isDissipateReqst( VMSReqst *req ); - -inline int -VMS__isCreateReqst( VMSReqst *req ); +// +//VMSReqst * +//VMS__take_top_request_from( VirtProcr *reqstingPr ); +// +//inline int +//VMS__isSemanticReqst( VMSReqst *req ); +// +//inline int +//VMS__isDissipateReqst( VMSReqst *req ); +// +//inline int +//VMS__isCreateReqst( VMSReqst *req ); //========================== diff -r 2952d337d6f3 -r f59cfa31a579 probes.c --- a/probes.c Sat Oct 30 20:55:39 2010 -0700 +++ b/probes.c Sat Oct 30 21:53:55 2010 -0700 @@ -8,6 +8,7 @@ #include #include #include +#include #include "VMS.h" #include "Queue_impl/BlockingQueue.h" @@ -123,17 +124,36 @@ IntervalProbe * create_generic_probe( char *nameStr, VirtProcr *animPr ) { IntervalProbe *newProbe; - int32 idx; VMSSemReq reqData; reqData.reqType = createProbe; reqData.nameStr = nameStr; - VMS__send_VMSSem_request( reqData, animPr ); + VMS__send_VMSSem_request( &reqData, animPr ); return animPr->dataReturnedFromReq; } +/*Use this version from outside VMS -- it uses external malloc, and modifies + * dynamic array, so can't be animated in a slave VP + */ +IntervalProbe * +ext__create_generic_probe( char *nameStr ) + { IntervalProbe *newProbe; + int32 nameLen; + + newProbe = malloc( sizeof(IntervalProbe) ); + nameLen = strlen( nameStr ); + newProbe->nameStr = malloc( nameLen ); + memcpy( newProbe->nameStr, nameStr, nameLen ); + newProbe->hist = NULL; + newProbe->schedChoiceWasRecorded = FALSE; + newProbe->probeID = + addToDynArray( newProbe, _VMSMasterEnv->dynIntervalProbesInfo ); + + return newProbe; + } + int32 VMS_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr ) { IntervalProbe *newProbe; @@ -154,6 +174,25 @@ } int32 +VMS_ext_impl__record_time_point_into_new_probe( char *nameStr ) + { IntervalProbe *newProbe; + struct timeval *startStamp; + float64 startSecs; + + newProbe = ext__create_generic_probe( nameStr ); + newProbe->endSecs = 0; + + gettimeofday( &(newProbe->startStamp), NULL); + + //turn into a double + startStamp = &(newProbe->startStamp); + startSecs = startStamp->tv_sec + ( startStamp->tv_usec / 1000000.0 ); + newProbe->startSecs = startSecs; + + return newProbe->probeID; + } + +int32 VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr ) { IntervalProbe *newProbe; diff -r 2952d337d6f3 -r f59cfa31a579 probes.h --- a/probes.h Sat Oct 30 20:55:39 2010 -0700 +++ b/probes.h Sat Oct 30 21:53:55 2010 -0700 @@ -14,9 +14,6 @@ #include - //turns on the probe-instrumentation in the application -- when not - // defined, the calls to the probe functions turn into comments -//#define STATS__ENABLE_PROBES //when STATS__TURN_ON_PROBES is defined allows using probes to measure // time intervals. The probes are macros that only compile to something @@ -72,9 +69,9 @@ VMS_impl__record_time_point_in_new_probe( nameStr, animPr ) int32 -VMS_ext_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr); +VMS_ext_impl__record_time_point_into_new_probe( char *nameStr ); #define VMS_ext__record_time_point_into_new_probe( nameStr ) \ - VMS_ext_impl__record_time_point_into_new_probe_impl( nameStr ) + VMS_ext_impl__record_time_point_into_new_probe( nameStr ) int32