changeset 14:bcc22f6f11a5

Added min work-unit cycles and measre primitive time
author Me
date Sun, 10 Oct 2010 09:37:47 -0700
parents a9971dbe5328
children 6eb80110976c
files SSR.h SSR_lib.c
diffstat 2 files changed, 45 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/SSR.h	Wed Sep 01 08:28:08 2010 -0700
     1.2 +++ b/SSR.h	Sun Oct 10 09:37:47 2010 -0700
     1.3 @@ -45,9 +45,10 @@
     1.4  typedef struct
     1.5   {
     1.6     PrivQueueStruc **readyVPQs;
     1.7 -   HashTable      *commHashTbl;
     1.8 -   int             numVirtPr;
     1.9 -   int             nextCoreToGetNewPr;
    1.10 +   HashTable       *commHashTbl;
    1.11 +   int32            numVirtPr;
    1.12 +   int32            nextCoreToGetNewPr;
    1.13 +   int32            primitiveStartTime;
    1.14   }
    1.15  SSRSemEnv;
    1.16  
    1.17 @@ -57,6 +58,16 @@
    1.18  void
    1.19  SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
    1.20  
    1.21 +int32
    1.22 +SSR__giveMinWorkUnitCycles( float32 percentOverhead );
    1.23 +
    1.24 +void inline
    1.25 +SSR__start_primitive();
    1.26 +
    1.27 +int32 inline
    1.28 +SSR__end_primitive_and_give_cycles();
    1.29 +
    1.30 +
    1.31  //=======================
    1.32  
    1.33  void
     2.1 --- a/SSR_lib.c	Wed Sep 01 08:28:08 2010 -0700
     2.2 +++ b/SSR_lib.c	Sun Oct 10 09:37:47 2010 -0700
     2.3 @@ -120,6 +120,37 @@
     2.4   }
     2.5  
     2.6  
     2.7 +int32
     2.8 +SSR__giveMinWorkUnitCycles( float32 percentOverhead )
     2.9 + {
    2.10 +   return 5000;
    2.11 + }
    2.12 +
    2.13 +
    2.14 +/*For now, use TSC -- later, make these two macros with assembly that first
    2.15 + * saves jump point, and second jumps back several times to get reliable time
    2.16 + */
    2.17 +void inline
    2.18 +SSR__start_primitive()
    2.19 + { int32 *saveAddr;
    2.20 +   saveAddr = &(((SSRSemEnv *)(_VMSMasterEnv->semanticEnv))->primitiveStartTime);
    2.21 +   saveLowTimeStampCountInto( saveAddr );
    2.22 + }
    2.23 +
    2.24 +/*Just quick and dirty for now -- make reliable later
    2.25 + * will want this to jump back several times -- to be sure cache is warm
    2.26 + * because don't want comm time included in calc-time measurement -- and
    2.27 + * also to throw out any "weird" values due to OS interrupt or TSC rollover
    2.28 + */
    2.29 +int32 inline
    2.30 +SSR__end_primitive_and_give_cycles()
    2.31 + { int32 endTime, startTime;
    2.32 +   //TODO: fix by repeating time-measurement
    2.33 +   saveLowTimeStampCountInto( endTime );
    2.34 +   startTime = ((SSRSemEnv *)(_VMSMasterEnv->semanticEnv))->primitiveStartTime;
    2.35 +   return (endTime - startTime);
    2.36 + }
    2.37 +
    2.38  //===========================================================================
    2.39  
    2.40  /*Initializes all the data-structures for a SSR system -- but doesn't