# HG changeset patch # User Nina Engelhardt # Date 1331229848 -3600 # Node ID e11ba112a0c73126491df50d6f850b607435bde9 # Parent 6b723b55b9a00b26d73e2c9872f346f3833ad28e idle tasks diff -r 6b723b55b9a0 -r e11ba112a0c7 SSR.h --- a/SSR.h Fri Feb 10 18:34:51 2012 +0100 +++ b/SSR.h Thu Mar 08 19:04:08 2012 +0100 @@ -119,6 +119,7 @@ #ifdef MEAS__PERF_COUNTERS ListOfArrays* counterList[NUM_CORES]; #endif + VirtProcr* idlePr[NUM_CORES][NUM_SCHED_SLOTS]; } SSRSemEnv; diff -r 6b723b55b9a0 -r e11ba112a0c7 SSR_Counter_Recording.c --- a/SSR_Counter_Recording.c Fri Feb 10 18:34:51 2012 +0100 +++ b/SSR_Counter_Recording.c Thu Mar 08 19:04:08 2012 +0100 @@ -12,12 +12,10 @@ void SSR__counter_handler(int evt_type, int vpid, int task, VirtProcr* pr, uint64 cycles, uint64 instrs) { - if(!pr) + + if (pr->isMasterVP || pr->isShutdownVP) { //Save only values for actual work return; - - //FIXME: find more reliable way to separate master and slave VPs - if (pr->isMasterVP || pr->isShutdownVP) //filters master VPs & shutdown - return; + } SSRSemEnv *semanticEnv = _VMSMasterEnv->semanticEnv; @@ -32,14 +30,20 @@ if(pr){ e.coreID = pr->coreAnimatedBy; e.slot = pr->schedSlot; + } else { + e.coreID = -1; + e.slot = NULL; } int corenum; if(pr) corenum = pr->coreAnimatedBy; else return; - - addToListOfArrays(CounterEvent,e,semanticEnv->counterList[corenum]); - + + if(evt_type==Work_start || evt_type==Work_end || evt_type==AppResponderInvocation_start){ + addToListOfArrays_ext(CounterEvent,e,semanticEnv->counterList[corenum]); + } else { + addToListOfArrays(CounterEvent,e,semanticEnv->counterList[corenum]); + } } void set_counter_file(FILE* f){ @@ -54,28 +58,44 @@ fprintf(counterfile, "AppResponderInvocation_start"); break; case AppResponder_start: - fprintf(counterfile, "MasterLoop_beforeReqHdlr"); + fprintf(counterfile, "AppResponder_start"); break; case AppResponder_end: - fprintf(counterfile, "MasterLoop_afterReqHdlr"); + fprintf(counterfile, "AppResponder_end"); + break; + case AssignerInvocation_start: + fprintf(counterfile, "AssignerInvocation_start"); + break; + case NextAssigner_start: + fprintf(counterfile, "NextAssigner_start"); break; case Assigner_start: - fprintf(counterfile, "MasterLoop_beforeAssign"); + fprintf(counterfile, "Assigner_start"); break; case Assigner_end: - fprintf(counterfile, "MasterLoop_afterAssign"); + fprintf(counterfile, "Assigner_end"); break; case Work_end: - fprintf(counterfile, "CoreLoop_afterWork"); + fprintf(counterfile, "Work_end"); break; case Work_start: - fprintf(counterfile, "CoreLoop_beforeWork"); + fprintf(counterfile, "Work_start"); break; case HwResponderInvocation_start: - fprintf(counterfile, "Procr_suspend"); + fprintf(counterfile, "HwResponderInvocation_start"); + break; + case Timestamp_start: + fprintf(counterfile, "Timestamp_start"); + break; + case Timestamp_end: + fprintf(counterfile, "Timestamp_end"); break; default: fprintf(counterfile, "unknown event"); } - fprintf(counterfile,", %d, %d, %llu, %llu\n",e->vp,e->task,e->cycles,e->instrs); + fprintf(counterfile,", %d, %d, %llu, %llu",e->vp,e->task,e->cycles,e->instrs); + if(e->coreID >=0) + fprintf(counterfile,", %d",e->coreID); + fprintf(counterfile,"\n"); + fflush(counterfile); } \ No newline at end of file diff -r 6b723b55b9a0 -r e11ba112a0c7 SSR_PluginFns.c --- a/SSR_PluginFns.c Fri Feb 10 18:34:51 2012 +0100 +++ b/SSR_PluginFns.c Thu Mar 08 19:04:08 2012 +0100 @@ -44,6 +44,26 @@ schedPr = readPrivQ( semEnv->readyVPQs[coreNum] ); //Note, using a non-blocking queue -- it returns NULL if queue empty + if(!schedPr){ + schedPr = semEnv->idlePr[coreNum][slotNum]; + //things that would normally happen in resume(), but these VPs never go there + #ifdef OBSERVE_UCC + schedPr->numTimesScheduled++; //Somewhere here! + Unit newu; + newu.vp = schedPr->procrID; + newu.task = schedPr->numTimesScheduled; + addToListOfArrays(Unit,newu,semEnv->unitList); + + if (schedPr->numTimesScheduled > 1){ + Dependency newd; + newd.from_vp = schedPr->procrID; + newd.from_task = schedPr->numTimesScheduled - 1; + newd.to_vp = schedPr->procrID; + newd.to_task = schedPr->numTimesScheduled; + addToListOfArrays(Dependency, newd ,semEnv->ctlDependenciesList); + } + #endif + } #ifdef OBSERVE_UCC if (schedPr) { //schedPr->numTimesScheduled++; diff -r 6b723b55b9a0 -r e11ba112a0c7 SSR_lib.c --- a/SSR_lib.c Fri Feb 10 18:34:51 2012 +0100 +++ b/SSR_lib.c Thu Mar 08 19:04:08 2012 +0100 @@ -194,11 +194,17 @@ } #endif +void idle_fn(void* data, VirtProcr *animatingPr){ + while(1){ + VMS__suspend_procr(animatingPr); + } +} + void SSR__init_Helper() { SSRSemEnv *semanticEnv; PrivQueueStruc **readyVPQs; - int coreIdx, i; + int coreIdx, i, j; //Hook up the semantic layer's plug-ins to the Master virt procr _VMSMasterEnv->requestHandler = &SSR__Request_Handler; @@ -215,6 +221,13 @@ #ifdef MEAS__PERF_COUNTERS SSR__init_counter_data_structs(); #endif + for(i=0;iidlePr[i][j] = VMS__create_procr(&idle_fn,NULL); + semanticEnv->idlePr[i][j]->coreAnimatedBy = i; + } + } + #ifdef OBSERVE_UCC semanticEnv->unitList = makeListOfArrays(sizeof(Unit),128); semanticEnv->ctlDependenciesList = makeListOfArrays(sizeof(Dependency),128); @@ -365,8 +378,8 @@ int i; for(i=0;icounterList[i], &print_counter_events_to_file ); + fflush(output); } - fflush(output); } else printf("Opening UCC file failed. Please check that folder \"counters\" exists in run directory and has write permission.\n");