diff MasterLoop.c @ 166:aefd87f9d12f

loop graph
author Nina Engelhardt
date Tue, 18 Oct 2011 15:53:04 +0200
parents 395f58384a5c
children 981acd1db6af
line diff
     1.1 --- a/MasterLoop.c	Wed Sep 28 14:58:41 2011 +0200
     1.2 +++ b/MasterLoop.c	Tue Oct 18 15:53:04 2011 +0200
     1.3 @@ -90,6 +90,8 @@
     1.4     volatileMasterPr = animatingPr;
     1.5     masterPr         = (VirtProcr*)volatileMasterPr; //used to force re-define after jmp
     1.6  
     1.7 +   bulb b = new_bulb();
     1.8 +   numSlotsFilled=1;
     1.9        //First animation of each MasterVP will in turn animate this part
    1.10        // of setup code.. (VP creator sets up the stack as if this function
    1.11        // was called normally, but actually get here by jmp)
    1.12 @@ -129,6 +131,14 @@
    1.13     slaveScheduler   = masterEnv->slaveScheduler;
    1.14     semanticEnv      = masterEnv->semanticEnv;
    1.15  
    1.16 +   #ifdef DETECT_LOOP_GRAPH
    1.17 +   if(numSlotsFilled > 0){
    1.18 +   b = new_bulb();
    1.19 +   addToDynArray((void*)b,masterEnv->loop_graph_array_info);
    1.20 +   set_bulb_core(b,thisCoresIdx);
    1.21 +   set_bulb_id(b,masterEnv->loop_counter[thisCoresIdx]++);
    1.22 +   }
    1.23 +   #endif
    1.24  
    1.25        //Poll each slot's Done flag
    1.26     numSlotsFilled = 0;
    1.27 @@ -160,6 +170,8 @@
    1.28                 Dependency* newd = new_dependency(currSlot->procrAssignedToSlot->procrID,lastRecord->task_position,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position + 1);
    1.29                 addToDynArray((void*) newd ,masterEnv->dependenciesInfo);     
    1.30                
    1.31 +
    1.32 +               
    1.33                 //print_record_human_readable(lastRecord);
    1.34                 //create new entry in record array
    1.35                 CounterRecord* newRecord = VMS__malloc(sizeof(CounterRecord));
    1.36 @@ -217,6 +229,13 @@
    1.37              writeVMSQ( schedVirtPr, readyToAnimateQ );
    1.38            }
    1.39         }
    1.40 +               #ifdef DETECT_LOOP_GRAPH
    1.41 +               if(!currSlot->needsProcrAssigned) {
    1.42 +                   int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1;
    1.43 +                   CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx];
    1.44 +                   set_bulb_member(b,slotIdx,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position);
    1.45 +               }
    1.46 +               #endif
    1.47      }
    1.48  
    1.49