# HG changeset patch # User Nina Engelhardt # Date 1325691610 -3600 # Node ID 3bd35fc83c618c1c331bcb49fcaa1b0c3c3cc352 # Parent 981acd1db6afdc628350ac8e3a03044b2b07b1bd move loopgraph recording to plugin (\! changed scheduler fn prototype \!) diff -r 981acd1db6af -r 3bd35fc83c61 Counters/run_graph.py --- a/Counters/run_graph.py Mon Dec 05 18:59:48 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -#!/usr/bin/python - -import sys -import pygraph - -if len(sys.argv)<3 : - print "Usage:",sys.argv[0],"dependencyfile.dot counterfile.csv" - sys.exit() - -try: - dependencyfile = open(sys.argv[1]) - dependencystring = dependencyfile.read() -except IOError as (errno, strerror): - print "Error {0}: {1}".format(errno, strerror) - sys.exit() - -try: - counterfile = open(sys.argv[2]) -except IOError as (errno, strerror): - print (("Error {0}: {1}".format)(errno, strerror)) - sys.exit() - -from pygraph.readwrite.dot import read,write - -dependencygraph = read(dependencystring) - -import csv - -counterreader = (csv.reader)(counterfile) - - - -for row in counterreader: - dependencygraph.add_node_attribute('VP_{0}_{1}'.format(row[0],row[1]),('suspend_point',row[2])) - dependencygraph.add_node_attribute('VP_{0}_{1}'.format(row[0],row[1]),('schedule_check_cycles',int(row[4])-int(row[19]))) - dependencygraph.add_node_attribute('VP_{0}_{1}'.format(row[0],row[1]),('sync_cycles',int(row[25])-int(row[24]))) - dependencygraph.add_node_attribute('VP_{0}_{1}'.format(row[0],row[1]),('assign_cycles',int(row[10])-int(row[7]))) - dependencygraph.add_node_attribute('VP_{0}_{1}'.format(row[0],row[1]),('work_comm_cycles',int(row[16])-int(row[13]))) - dependencygraph.add_node_attribute('VP_{0}_{1}'.format(row[0],row[1]),('status_cycles',int(row[22])-int(row[16]))) - - -def path_length(path): - length = 0 - for node in path: - attrd = dict(dependencygraph.node_attributes(node)) - length += attrd['schedule_check_cycles'] - length += attrd['sync_cycles'] - length += attrd['assign_cycles'] - length += attrd['work_comm_cycles'] - length += attrd['status_cycles'] - return length - - -def find_critical_path(graph, start, end, path=[]): - path = path + [end] - if start == end: - return path - if not graph.has_node(end): - return None - longest = None - for node in graph.incidents(end): - if node not in path: - newpath = find_critical_path(graph, start, node, path) - if newpath: - if not longest or path_length(newpath) > path_length(longest): - longest = newpath - return longest - -cr= find_critical_path(dependencygraph, 'VP_2_0', 'VP_2_97') - -for node in cr: - dependencygraph.add_node_attribute(node,('color','red')) - dependencygraph.add_node_attribute(node,('style','bold')) - -print write(dependencygraph) diff -r 981acd1db6af -r 3bd35fc83c61 MasterLoop.c --- a/MasterLoop.c Mon Dec 05 18:59:48 2011 +0100 +++ b/MasterLoop.c Wed Jan 04 16:40:10 2012 +0100 @@ -132,12 +132,7 @@ semanticEnv = masterEnv->semanticEnv; #ifdef DETECT_LOOP_GRAPH - if(numSlotsFilled > 0){ - b = new_bulb(); - addToDynArray((void*)b,masterEnv->loop_graph_array_info); - set_bulb_core(b,thisCoresIdx); - set_bulb_id(b,masterEnv->loop_counter[thisCoresIdx]++); - } + #endif //Poll each slot's Done flag @@ -209,14 +204,14 @@ saveCyclesAndInstrs(thisCoresIdx,tmp_cycles,tmp_instrs); #endif schedVirtPr = - (*slaveScheduler)( semanticEnv, thisCoresIdx ); + (*slaveScheduler)( semanticEnv, thisCoresIdx, slotIdx ); if( schedVirtPr != NULL ) { currSlot->procrAssignedToSlot = schedVirtPr; schedVirtPr->schedSlot = currSlot; currSlot->needsProcrAssigned = FALSE; numSlotsFilled += 1; - schedVirtPr->numTimesScheduled++; + #ifdef MEAS__PERF_COUNTERS //end assigner int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; @@ -226,16 +221,13 @@ lastRecord->start_assign_instrs = tmp_instrs; saveCyclesAndInstrs(thisCoresIdx,lastRecord->end_assign_cycles,lastRecord->end_assign_instrs); #endif + #ifdef DETECT_LOOP_GRAPH + + #endif writeVMSQ( schedVirtPr, readyToAnimateQ ); } } - #ifdef DETECT_LOOP_GRAPH - if(!currSlot->needsProcrAssigned) { - int lastRecordIdx = currSlot->procrAssignedToSlot->counter_history_array_info->numInArray -1; - CounterRecord* lastRecord = currSlot->procrAssignedToSlot->counter_history[lastRecordIdx]; - set_bulb_member(b,slotIdx,currSlot->procrAssignedToSlot->procrID,lastRecord->task_position); - } - #endif + } diff -r 981acd1db6af -r 3bd35fc83c61 VMS.c --- a/VMS.c Mon Dec 05 18:59:48 2011 +0100 +++ b/VMS.c Wed Jan 04 16:40:10 2012 +0100 @@ -188,13 +188,7 @@ #ifdef DETECT_LOOP_GRAPH - _VMSMasterEnv->loop_graph = VMS__malloc(10*sizeof(void*)); - _VMSMasterEnv->loop_graph_array_info = makePrivDynArrayInfoFrom((void***)&(_VMSMasterEnv->loop_graph),10); - int loop_i; - for(loop_i=0;loop_iloop_counter[loop_i]=0; - } - + #endif #ifdef MEAS__PERF_COUNTERS @@ -785,41 +779,7 @@ //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, (DynArrayFnPtr)&saveHistToFile); //forAllInDynArrayDo( _VMSMasterEnv->measHistsInfo, &freeHistExt ); - #ifdef DETECT_LOOP_GRAPH - FILE* loop_output; - int loop_n; - char loop_filename[255]; - for(loop_n=0;loop_n<255;loop_n++) - { - sprintf(loop_filename, "./counters/LoopGraph.%d.dot",loop_n); - loop_output = fopen(loop_filename,"r"); - if(loop_output) - { - fclose(loop_output); - }else{ - break; - } - } - if(loop_n<255){ - printf("Saving Loop Graph to File: %s ...\n", loop_filename); - loop_output = fopen(loop_filename,"w+"); - if(loop_output!=NULL){ - set_dependency_file(loop_output); - fprintf(loop_output,"digraph Loop {\n"); - set_loop_file(loop_output); - forAllInDynArrayDo(_VMSMasterEnv->counter_history_array_info, &print_dot_node_info ); - forAllInDynArrayDo( _VMSMasterEnv->loop_graph_array_info, &print_per_slot_to_file ); - //int coreIdx; - //for(coreIdx=0;coreIdxloop_counter[coreIdx]); - //} - fprintf(loop_output,"}\n"); - } else - printf("Opening Loop Graph file failed. Please check that folder \"counters\" exists in run directory.\n"); - } else { - printf("Could not open Loop Graph file, please clean \"counters\" folder. (Must contain less than 255 files.)\n"); - } -#endif + #ifdef MEAS__TIME_PLUGIN printHist( _VMSMasterEnv->reqHdlrLowTimeHist ); saveHistToFile( _VMSMasterEnv->reqHdlrLowTimeHist ); diff -r 981acd1db6af -r 3bd35fc83c61 VMS.h --- a/VMS.h Mon Dec 05 18:59:48 2011 +0100 +++ b/VMS.h Wed Jan 04 16:40:10 2012 +0100 @@ -18,6 +18,7 @@ #include "vmalloc.h" #include "Counters/Counters.h" #include "loop.h" +#include "ListOfArrays/ListOfArrays.h" #include #include @@ -124,7 +125,7 @@ typedef struct _GateStruc GateStruc; -typedef VirtProcr * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx +typedef VirtProcr * (*SlaveScheduler) ( void *, int, int ); //semEnv, coreIdx typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr typedef void VirtProcrFn ( void *, VirtProcr * ); //initData, animPr @@ -279,9 +280,7 @@ PrivDynArrayInfo* counter_history_array_info; #endif #ifdef DETECT_LOOP_GRAPH - bulb* loop_graph; - PrivDynArrayInfo* loop_graph_array_info; - int loop_counter[NUM_CORES]; + #endif } MasterEnv; diff -r 981acd1db6af -r 3bd35fc83c61 loop.c --- a/loop.c Mon Dec 05 18:59:48 2011 +0100 +++ b/loop.c Wed Jan 04 16:40:10 2012 +0100 @@ -46,7 +46,7 @@ for(i=0;i VP_%d_%d;\n",prev_slots[b[2*NUM_SCHED_SLOTS]][2*i],prev_slots[b[2*NUM_SCHED_SLOTS]][2*i+1],b[2*i],b[2*i+1]); + fprintf(loop_file, "loopDep, %d, %d, %d, %d;\n",prev_slots[b[2*NUM_SCHED_SLOTS]][2*i],prev_slots[b[2*NUM_SCHED_SLOTS]][2*i+1],b[2*i],b[2*i+1]); } prev_slots[b[2*NUM_SCHED_SLOTS]][2*i] = b[2*i]; prev_slots[b[2*NUM_SCHED_SLOTS]][2*i+1] = b[2*i+1];