changeset 54:f8508572f3de

Added boolean guarded debug messages and VMS__throw_exception
author Me
date Tue, 02 Nov 2010 16:43:01 -0700
parents 42dd44df1bb0
children 3bac84e4e56e 85b731b290f8
files VMS.c VMS.h probes.c
diffstat 3 files changed, 40 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/VMS.c	Mon Nov 01 21:21:32 2010 -0700
     1.2 +++ b/VMS.c	Tue Nov 02 16:43:01 2010 -0700
     1.3 @@ -288,7 +288,8 @@
     1.4     #ifdef STATS__TURN_ON_PROBES
     1.5     struct timeval timeStamp;
     1.6     gettimeofday( &(timeStamp), NULL);
     1.7 -   newPr->createPtInSecs = timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0);
     1.8 +   newPr->createPtInSecs = timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0) -
     1.9 +                                               _VMSMasterEnv->createPtInSecs;
    1.10     #endif
    1.11     //========================================================================
    1.12  
    1.13 @@ -752,3 +753,20 @@
    1.14     free( (void *)_VMSMasterEnv );
    1.15   }
    1.16  
    1.17 +
    1.18 +//================================
    1.19 +
    1.20 +
    1.21 +/*Later, improve this -- for now, just exits the application after printing
    1.22 + * the error message.
    1.23 + */
    1.24 +void
    1.25 +VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData )
    1.26 + {
    1.27 +   printf(msgStr);
    1.28 +   fflush(stdin);
    1.29 +   exit(1);
    1.30 + }
    1.31 +
    1.32 +
    1.33 +
     2.1 --- a/VMS.h	Mon Nov 01 21:21:32 2010 -0700
     2.2 +++ b/VMS.h	Tue Nov 02 16:43:01 2010 -0700
     2.3 @@ -22,6 +22,10 @@
     2.4  
     2.5  
     2.6  //===============================  Debug  ===================================
     2.7 +   //These defines turn types of bug messages on and off
     2.8 +#define dbgProbes FALSE
     2.9 +#define dbgAppFlow FALSE
    2.10 +
    2.11     //When SEQUENTIAL is defined, VMS does sequential exe in the main thread
    2.12     // It still does co-routines and all the mechanisms are the same, it just
    2.13     // has only a single thread and animates VPs one at a time
    2.14 @@ -32,7 +36,8 @@
    2.15  #define STATS__ENABLE_PROBES
    2.16  
    2.17  
    2.18 -#define PRINT_DEBUG(msg)// printf(msg); fflush(stdin);
    2.19 +#define DEBUG(msg)// printf(msg); fflush(stdin);
    2.20 +#define DEBUG_MSG( bool, msg) //if( bool){ printf(msg); fflush(stdin);}
    2.21  #define PRINT1_DEBUG(msg, param) //printf(msg, param); fflush(stdin);
    2.22  #define PRINT2_DEBUG(msg, p1, p2) //printf(msg, p1, p2); fflush(stdin);
    2.23  
    2.24 @@ -40,7 +45,6 @@
    2.25  #define PRINT1_ERROR(msg, param) printf(msg, param); fflush(stdin);
    2.26  #define PRINT2_ERROR(msg, p1, p2) printf(msg, p1, p2); fflush(stdin);
    2.27  
    2.28 -
    2.29  //===========================  STATS =======================
    2.30  
    2.31     //when MEAS__TIME_STAMP_SUSP is defined, causes code to be inserted and
    2.32 @@ -67,11 +71,11 @@
    2.33  
    2.34  #define MASTERLOCK_RETRIES 10000
    2.35  
    2.36 -   // stack
    2.37 -#define VIRT_PROCR_STACK_SIZE 0x4000
    2.38 +   // stack size in virtual processors created
    2.39 +#define VIRT_PROCR_STACK_SIZE 0x4000 /* 16K */
    2.40  
    2.41 -   // memory for VMS__malloc -- 256M
    2.42 -#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x10000000
    2.43 +   // memory for VMS__malloc
    2.44 +#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x10000000 /* 256M */
    2.45  
    2.46  
    2.47  //==============================
    2.48 @@ -212,7 +216,12 @@
    2.49   }
    2.50  MasterEnv;
    2.51  
    2.52 +//=============================
    2.53 +typedef struct
    2.54 + {
    2.55  
    2.56 + }
    2.57 +VMSExcp;
    2.58  
    2.59  
    2.60  //=======================  OS Thread related  ===============================
    2.61 @@ -274,6 +283,9 @@
    2.62  VMS_ext__dissipate_procr( VirtProcr *procrToDissipate );
    2.63  
    2.64  void
    2.65 +VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData );
    2.66 +
    2.67 +void
    2.68  VMS__shutdown();
    2.69  
    2.70  void
     3.1 --- a/probes.c	Mon Nov 01 21:21:32 2010 -0700
     3.2 +++ b/probes.c	Tue Nov 02 16:43:01 2010 -0700
     3.3 @@ -253,6 +253,7 @@
     3.4  VMS_impl__record_interval_start_in_probe( int32 probeID )
     3.5   { IntervalProbe *probe;
     3.6  
     3.7 +         DEBUG_MSG( dbgProbes, "record start of interval\n" )
     3.8     probe = _VMSMasterEnv->intervalProbes[ probeID ];
     3.9     gettimeofday( &(probe->startStamp), NULL );
    3.10   }
    3.11 @@ -265,8 +266,9 @@
    3.12  VMS_impl__record_interval_end_in_probe( int32 probeID )
    3.13   { IntervalProbe *probe;
    3.14     struct timeval *endStamp, *startStamp;
    3.15 -   double startSecs, endSecs;
    3.16 +   float64 startSecs, endSecs;
    3.17  
    3.18 +         DEBUG_MSG( dbgProbes, "record end of interval\n" )
    3.19        //possible seg-fault if array resized by diff core right after this
    3.20        // one gets probe..?  Something like that?  Might be safe.. don't care
    3.21     probe = _VMSMasterEnv->intervalProbes[ probeID ];