diff VMS.c @ 65:13b22ffb8a2f

Nov 14 vers -- Added measurement of Plugin, malloc, & master lock, + vutilities
author Me
date Sun, 14 Nov 2010 11:17:52 -0800
parents 5cb919ac890f
children bf08108405cc 9c3107044f86
line diff
     1.1 --- a/VMS.c	Sat Nov 13 14:39:40 2010 -0800
     1.2 +++ b/VMS.c	Sun Nov 14 11:17:52 2010 -0800
     1.3 @@ -101,6 +101,16 @@
     1.4          //After this, all other mallocs are VMS__malloc.
     1.5     _VMSMasterEnv->freeListHead        = VMS_ext__create_free_list();
     1.6  
     1.7 +
     1.8 +   //============================= MEASUREMENT STUFF ========================
     1.9 +   #ifdef MEAS__TIME_MALLOC
    1.10 +   _VMSMasterEnv->mallocTimeHist  = makeFixedBinHistExt( 100, 50, 10,
    1.11 +                                                       "malloc time hist");
    1.12 +   _VMSMasterEnv->freeTimeHist  = makeFixedBinHistExt( 100, 50, 10,
    1.13 +                                                       "free time hist");
    1.14 +   #endif
    1.15 +   //========================================================================
    1.16 +
    1.17     //===================== Only VMS__malloc after this ====================
    1.18     masterEnv     = _VMSMasterEnv;
    1.19     
    1.20 @@ -147,6 +157,18 @@
    1.21     _VMSMasterEnv->createPtInSecs =
    1.22                             timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0);
    1.23     #endif
    1.24 +   #ifdef MEAS__TIME_PLUGIN
    1.25 +   _VMSMasterEnv->pluginLowTimeHist  = makeFixedBinHist( 50, 0, 2,
    1.26 +                                                     "plugin low time hist");
    1.27 +   _VMSMasterEnv->pluginHighTimeHist  = makeFixedBinHist( 100, 0, 200,
    1.28 +                                                    "plugin high time hist");
    1.29 +   #endif
    1.30 +   #ifdef MEAS__TIME_MASTER_LOCK
    1.31 +   _VMSMasterEnv->masterLockLowTimeHist  = makeFixedBinHist( 50, 0, 2,
    1.32 +                                                "master lock low time hist");
    1.33 +   _VMSMasterEnv->masterLockHighTimeHist  = makeFixedBinHist( 100, 0, 200,
    1.34 +                                               "master lock high time hist");
    1.35 +   #endif
    1.36     //========================================================================
    1.37  
    1.38   }
    1.39 @@ -600,9 +622,7 @@
    1.40     semReq = req->semReqData;
    1.41  
    1.42     newProbe          = VMS__malloc( sizeof(IntervalProbe) );
    1.43 -   nameLen = strlen( semReq->nameStr );
    1.44 -   newProbe->nameStr = VMS__malloc( nameLen );
    1.45 -   memcpy( newProbe->nameStr, semReq->nameStr, nameLen );
    1.46 +   newProbe->nameStr = VMS__strDup( semReq->nameStr );
    1.47     newProbe->hist    = NULL;
    1.48     newProbe->schedChoiceWasRecorded = FALSE;
    1.49  
    1.50 @@ -744,6 +764,44 @@
    1.51     VirtProcr      **masterVPs;
    1.52     SchedSlot     ***allSchedSlots; //ptr to array of ptrs
    1.53  
    1.54 +      //Before getting rid of everything, print out any measurements made
    1.55 +   #ifdef MEAS__TIME_PLUGIN
    1.56 +   printHist( _VMSMasterEnv->pluginLowTimeHist );
    1.57 +   printHist( _VMSMasterEnv->pluginHighTimeHist );
    1.58 +   #endif
    1.59 +   #ifdef MEAS__TIME_MALLOC
    1.60 +   printHist( _VMSMasterEnv->mallocTimeHist   );
    1.61 +   printHist( _VMSMasterEnv->freeTimeHist     );
    1.62 +   freeHistExt( _VMSMasterEnv->mallocTimeHist );
    1.63 +   freeHistExt( _VMSMasterEnv->freeTimeHist   );
    1.64 +   #endif
    1.65 +   #ifdef MEAS__TIME_MASTER_LOCK
    1.66 +   printHist( _VMSMasterEnv->masterLockLowTimeHist );
    1.67 +   printHist( _VMSMasterEnv->masterLockHighTimeHist );
    1.68 +   #endif
    1.69 +   #ifdef MEAS__TIME_MASTER
    1.70 +   printHist( _VMSMasterEnv->pluginTimeHist );
    1.71 +   for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
    1.72 +    {
    1.73 +      freeVMSQ( readyToAnimateQs[ coreIdx ] );
    1.74 +         //master VPs were created external to VMS, so use external free
    1.75 +      VMS__dissipate_procr( masterVPs[ coreIdx ] );
    1.76 +
    1.77 +      freeSchedSlots( allSchedSlots[ coreIdx ] );
    1.78 +    }
    1.79 +   #endif
    1.80 +   #ifdef MEAS__TIME_STAMP_SUSP
    1.81 +   printHist( _VMSMasterEnv->pluginTimeHist );
    1.82 +   for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
    1.83 +    {
    1.84 +      freeVMSQ( readyToAnimateQs[ coreIdx ] );
    1.85 +         //master VPs were created external to VMS, so use external free
    1.86 +      VMS__dissipate_procr( masterVPs[ coreIdx ] );
    1.87 +
    1.88 +      freeSchedSlots( allSchedSlots[ coreIdx ] );
    1.89 +    }
    1.90 +   #endif
    1.91 +
    1.92        //All the environment data has been allocated with VMS__malloc, so just
    1.93        // free its internal big-chunk and all inside it disappear.
    1.94  /*