# HG changeset patch # User Me # Date 1288741381 25200 # Node ID f8508572f3de9080da6148d30219271c7ecff065 # Parent 42dd44df1bb0c95951b2c208ae113e0c7247f611 Added boolean guarded debug messages and VMS__throw_exception diff -r 42dd44df1bb0 -r f8508572f3de VMS.c --- a/VMS.c Mon Nov 01 21:21:32 2010 -0700 +++ b/VMS.c Tue Nov 02 16:43:01 2010 -0700 @@ -288,7 +288,8 @@ #ifdef STATS__TURN_ON_PROBES struct timeval timeStamp; gettimeofday( &(timeStamp), NULL); - newPr->createPtInSecs = timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0); + newPr->createPtInSecs = timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0) - + _VMSMasterEnv->createPtInSecs; #endif //======================================================================== @@ -752,3 +753,20 @@ free( (void *)_VMSMasterEnv ); } + +//================================ + + +/*Later, improve this -- for now, just exits the application after printing + * the error message. + */ +void +VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData ) + { + printf(msgStr); + fflush(stdin); + exit(1); + } + + + diff -r 42dd44df1bb0 -r f8508572f3de VMS.h --- a/VMS.h Mon Nov 01 21:21:32 2010 -0700 +++ b/VMS.h Tue Nov 02 16:43:01 2010 -0700 @@ -22,6 +22,10 @@ //=============================== Debug =================================== + //These defines turn types of bug messages on and off +#define dbgProbes FALSE +#define dbgAppFlow FALSE + //When SEQUENTIAL is defined, VMS does sequential exe in the main thread // It still does co-routines and all the mechanisms are the same, it just // has only a single thread and animates VPs one at a time @@ -32,7 +36,8 @@ #define STATS__ENABLE_PROBES -#define PRINT_DEBUG(msg)// printf(msg); fflush(stdin); +#define DEBUG(msg)// printf(msg); fflush(stdin); +#define DEBUG_MSG( bool, msg) //if( bool){ 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); @@ -40,7 +45,6 @@ #define PRINT1_ERROR(msg, param) printf(msg, param); fflush(stdin); #define PRINT2_ERROR(msg, p1, p2) printf(msg, p1, p2); fflush(stdin); - //=========================== STATS ======================= //when MEAS__TIME_STAMP_SUSP is defined, causes code to be inserted and @@ -67,11 +71,11 @@ #define MASTERLOCK_RETRIES 10000 - // stack -#define VIRT_PROCR_STACK_SIZE 0x4000 + // stack size in virtual processors created +#define VIRT_PROCR_STACK_SIZE 0x4000 /* 16K */ - // memory for VMS__malloc -- 256M -#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x10000000 + // memory for VMS__malloc +#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x10000000 /* 256M */ //============================== @@ -212,7 +216,12 @@ } MasterEnv; +//============================= +typedef struct + { + } +VMSExcp; //======================= OS Thread related =============================== @@ -274,6 +283,9 @@ VMS_ext__dissipate_procr( VirtProcr *procrToDissipate ); void +VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData ); + +void VMS__shutdown(); void diff -r 42dd44df1bb0 -r f8508572f3de probes.c --- a/probes.c Mon Nov 01 21:21:32 2010 -0700 +++ b/probes.c Tue Nov 02 16:43:01 2010 -0700 @@ -253,6 +253,7 @@ VMS_impl__record_interval_start_in_probe( int32 probeID ) { IntervalProbe *probe; + DEBUG_MSG( dbgProbes, "record start of interval\n" ) probe = _VMSMasterEnv->intervalProbes[ probeID ]; gettimeofday( &(probe->startStamp), NULL ); } @@ -265,8 +266,9 @@ VMS_impl__record_interval_end_in_probe( int32 probeID ) { IntervalProbe *probe; struct timeval *endStamp, *startStamp; - double startSecs, endSecs; + float64 startSecs, endSecs; + DEBUG_MSG( dbgProbes, "record end of interval\n" ) //possible seg-fault if array resized by diff core right after this // one gets probe..? Something like that? Might be safe.. don't care probe = _VMSMasterEnv->intervalProbes[ probeID ];