# HG changeset patch # User Me # Date 1286728667 25200 # Node ID bcc22f6f11a5099e504e7d1fd716b9bdf009bb89 # Parent a9971dbe5328a721d0c83c0faca9eaf7846d0775 Added min work-unit cycles and measre primitive time diff -r a9971dbe5328 -r bcc22f6f11a5 SSR.h --- a/SSR.h Wed Sep 01 08:28:08 2010 -0700 +++ b/SSR.h Sun Oct 10 09:37:47 2010 -0700 @@ -45,9 +45,10 @@ typedef struct { PrivQueueStruc **readyVPQs; - HashTable *commHashTbl; - int numVirtPr; - int nextCoreToGetNewPr; + HashTable *commHashTbl; + int32 numVirtPr; + int32 nextCoreToGetNewPr; + int32 primitiveStartTime; } SSRSemEnv; @@ -57,6 +58,16 @@ void SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData ); +int32 +SSR__giveMinWorkUnitCycles( float32 percentOverhead ); + +void inline +SSR__start_primitive(); + +int32 inline +SSR__end_primitive_and_give_cycles(); + + //======================= void diff -r a9971dbe5328 -r bcc22f6f11a5 SSR_lib.c --- a/SSR_lib.c Wed Sep 01 08:28:08 2010 -0700 +++ b/SSR_lib.c Sun Oct 10 09:37:47 2010 -0700 @@ -120,6 +120,37 @@ } +int32 +SSR__giveMinWorkUnitCycles( float32 percentOverhead ) + { + return 5000; + } + + +/*For now, use TSC -- later, make these two macros with assembly that first + * saves jump point, and second jumps back several times to get reliable time + */ +void inline +SSR__start_primitive() + { int32 *saveAddr; + saveAddr = &(((SSRSemEnv *)(_VMSMasterEnv->semanticEnv))->primitiveStartTime); + saveLowTimeStampCountInto( saveAddr ); + } + +/*Just quick and dirty for now -- make reliable later + * will want this to jump back several times -- to be sure cache is warm + * because don't want comm time included in calc-time measurement -- and + * also to throw out any "weird" values due to OS interrupt or TSC rollover + */ +int32 inline +SSR__end_primitive_and_give_cycles() + { int32 endTime, startTime; + //TODO: fix by repeating time-measurement + saveLowTimeStampCountInto( endTime ); + startTime = ((SSRSemEnv *)(_VMSMasterEnv->semanticEnv))->primitiveStartTime; + return (endTime - startTime); + } + //=========================================================================== /*Initializes all the data-structures for a SSR system -- but doesn't