changeset 52:f59cfa31a579

fixed up probes just a bit
author Me
date Sat, 30 Oct 2010 21:53:55 -0700
parents 2952d337d6f3
children 42dd44df1bb0 420a09d3f32a
files CoreLoop.c VMS.c VMS.h probes.c probes.h
diffstat 5 files changed, 72 insertions(+), 20 deletions(-) [+]
line diff
     1.1 --- a/CoreLoop.c	Sat Oct 30 20:55:39 2010 -0700
     1.2 +++ b/CoreLoop.c	Sat Oct 30 21:53:55 2010 -0700
     1.3 @@ -109,7 +109,9 @@
     1.4              // jumps back to coreLoops's startPt
     1.5           currPr = _VMSMasterEnv->masterVPs[thisCoresIdx];
     1.6           if( _VMSMasterEnv->numMasterInARow[thisCoresIdx] > 10000 )
     1.7 -            printf("10000 back to back MasterVP\n");
     1.8 +          { //printf("10000 back to back MasterVP\n");
     1.9 +            pthread_yield();
    1.10 +          }
    1.11           _VMSMasterEnv->numMasterInARow[thisCoresIdx] += 1;
    1.12           break;  //end while -- have a VP to animate now
    1.13         }
     2.1 --- a/VMS.c	Sat Oct 30 20:55:39 2010 -0700
     2.2 +++ b/VMS.c	Sat Oct 30 21:53:55 2010 -0700
     2.3 @@ -549,8 +549,14 @@
     2.4   *  language -- but it's also a semantic thing that's triggered from and used
     2.5   *  in the application.. so it crosses abstractions..  so, need some special
     2.6   *  pattern here for handling such requests.
     2.7 + * Doing this just like it were a second language sharing VMS-core.
     2.8 + * 
     2.9   * This is called from the language's request handler when it sees a request
    2.10   *  of type VMSSemReq
    2.11 + *
    2.12 + * TODO: Later change this, to give probes their own separate plugin & have
    2.13 + *  VMS-core steer the request to appropriate plugin
    2.14 + * Do the same for OS calls -- look later at it..
    2.15   */
    2.16  void inline
    2.17  VMS__handle_VMSSemReq( VMSReqst *req, VirtProcr *requestingPr, void *semEnv,
     3.1 --- a/VMS.h	Sat Oct 30 20:55:39 2010 -0700
     3.2 +++ b/VMS.h	Sat Oct 30 21:53:55 2010 -0700
     3.3 @@ -27,6 +27,11 @@
     3.4     // has only a single thread and animates VPs one at a time
     3.5  //#define SEQUENTIAL
     3.6  
     3.7 +   //turns on the probe-instrumentation in the application -- when not
     3.8 +   // defined, the calls to the probe functions turn into comments
     3.9 +#define STATS__ENABLE_PROBES
    3.10 +
    3.11 +
    3.12  #define PRINT_DEBUG(msg)// printf(msg); fflush(stdin);
    3.13  #define PRINT1_DEBUG(msg, param) //printf(msg, param); fflush(stdin);
    3.14  #define PRINT2_DEBUG(msg, p1, p2) //printf(msg, p1, p2); fflush(stdin);
    3.15 @@ -279,6 +284,9 @@
    3.16  void
    3.17  VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr );
    3.18  
    3.19 +inline void
    3.20 +VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr );
    3.21 +
    3.22  void
    3.23  VMS__free_request( VMSReqst *req );
    3.24  
    3.25 @@ -286,22 +294,22 @@
    3.26  VMS__remove_and_free_top_request( VirtProcr *reqstingPr );
    3.27  
    3.28  VMSReqst *
    3.29 -VMS__take_top_request_from( VirtProcr *reqstingPr );
    3.30 -
    3.31 -VMSReqst *
    3.32  VMS__take_next_request_out_of( VirtProcr *procrWithReq );
    3.33  
    3.34  inline void *
    3.35  VMS__take_sem_reqst_from( VMSReqst *req );
    3.36 -
    3.37 -inline int
    3.38 -VMS__isSemanticReqst( VMSReqst *req );
    3.39 -
    3.40 -inline int
    3.41 -VMS__isDissipateReqst( VMSReqst *req );
    3.42 -
    3.43 -inline int
    3.44 -VMS__isCreateReqst( VMSReqst *req );
    3.45 +//
    3.46 +//VMSReqst *
    3.47 +//VMS__take_top_request_from( VirtProcr *reqstingPr );
    3.48 +//
    3.49 +//inline int
    3.50 +//VMS__isSemanticReqst( VMSReqst *req );
    3.51 +//
    3.52 +//inline int
    3.53 +//VMS__isDissipateReqst( VMSReqst *req );
    3.54 +//
    3.55 +//inline int
    3.56 +//VMS__isCreateReqst( VMSReqst *req );
    3.57  
    3.58  //==========================
    3.59  
     4.1 --- a/probes.c	Sat Oct 30 20:55:39 2010 -0700
     4.2 +++ b/probes.c	Sat Oct 30 21:53:55 2010 -0700
     4.3 @@ -8,6 +8,7 @@
     4.4  #include <stdlib.h>
     4.5  #include <malloc.h>
     4.6  #include <sys/time.h>
     4.7 +#include <string.h>
     4.8  
     4.9  #include "VMS.h"
    4.10  #include "Queue_impl/BlockingQueue.h"
    4.11 @@ -123,17 +124,36 @@
    4.12  IntervalProbe *
    4.13  create_generic_probe( char *nameStr, VirtProcr *animPr )
    4.14   { IntervalProbe *newProbe;
    4.15 -   int32 idx;
    4.16     VMSSemReq reqData;
    4.17  
    4.18     reqData.reqType  = createProbe;
    4.19     reqData.nameStr  = nameStr;
    4.20  
    4.21 -   VMS__send_VMSSem_request( reqData, animPr );
    4.22 +   VMS__send_VMSSem_request( &reqData, animPr );
    4.23  
    4.24     return animPr->dataReturnedFromReq;
    4.25   }
    4.26  
    4.27 +/*Use this version from outside VMS -- it uses external malloc, and modifies
    4.28 + * dynamic array, so can't be animated in a slave VP
    4.29 + */
    4.30 +IntervalProbe *
    4.31 +ext__create_generic_probe( char *nameStr )
    4.32 + { IntervalProbe *newProbe;
    4.33 +   int32          nameLen;
    4.34 +
    4.35 +   newProbe          = malloc( sizeof(IntervalProbe) );
    4.36 +   nameLen = strlen( nameStr );
    4.37 +   newProbe->nameStr = malloc( nameLen );
    4.38 +   memcpy( newProbe->nameStr, nameStr, nameLen );
    4.39 +   newProbe->hist    = NULL;
    4.40 +   newProbe->schedChoiceWasRecorded = FALSE;
    4.41 +   newProbe->probeID =
    4.42 +             addToDynArray( newProbe, _VMSMasterEnv->dynIntervalProbesInfo );
    4.43 +
    4.44 +   return newProbe;
    4.45 + }
    4.46 +
    4.47  int32
    4.48  VMS_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr )
    4.49   { IntervalProbe *newProbe;
    4.50 @@ -154,6 +174,25 @@
    4.51   }
    4.52  
    4.53  int32
    4.54 +VMS_ext_impl__record_time_point_into_new_probe( char *nameStr )
    4.55 + { IntervalProbe *newProbe;
    4.56 +   struct timeval *startStamp;
    4.57 +   float64 startSecs;
    4.58 +
    4.59 +   newProbe           = ext__create_generic_probe( nameStr );
    4.60 +   newProbe->endSecs  = 0;
    4.61 +
    4.62 +   gettimeofday( &(newProbe->startStamp), NULL);
    4.63 +
    4.64 +      //turn into a double
    4.65 +   startStamp = &(newProbe->startStamp);
    4.66 +   startSecs = startStamp->tv_sec + ( startStamp->tv_usec / 1000000.0 );
    4.67 +   newProbe->startSecs = startSecs;
    4.68 +
    4.69 +   return newProbe->probeID;
    4.70 + }
    4.71 +
    4.72 +int32
    4.73  VMS_impl__create_single_interval_probe( char *nameStr, VirtProcr *animPr )
    4.74   { IntervalProbe *newProbe;
    4.75  
     5.1 --- a/probes.h	Sat Oct 30 20:55:39 2010 -0700
     5.2 +++ b/probes.h	Sat Oct 30 21:53:55 2010 -0700
     5.3 @@ -14,9 +14,6 @@
     5.4  
     5.5  #include <sys/time.h>
     5.6  
     5.7 -   //turns on the probe-instrumentation in the application -- when not
     5.8 -   // defined, the calls to the probe functions turn into comments
     5.9 -//#define STATS__ENABLE_PROBES
    5.10  
    5.11     //when STATS__TURN_ON_PROBES is defined allows using probes to measure
    5.12     // time intervals.  The probes are macros that only compile to something
    5.13 @@ -72,9 +69,9 @@
    5.14          VMS_impl__record_time_point_in_new_probe( nameStr, animPr )
    5.15  
    5.16  int32
    5.17 -VMS_ext_impl__record_time_point_into_new_probe( char *nameStr, VirtProcr *animPr);
    5.18 +VMS_ext_impl__record_time_point_into_new_probe( char *nameStr );
    5.19  #define VMS_ext__record_time_point_into_new_probe( nameStr ) \
    5.20 -        VMS_ext_impl__record_time_point_into_new_probe_impl( nameStr )
    5.21 +        VMS_ext_impl__record_time_point_into_new_probe( nameStr )
    5.22  
    5.23  
    5.24  int32