changeset 46:bde026832af7 perf_counters

switch dependencies to ListOfArrays
author Nina Engelhardt <nengel@mailbox.tu-berlin.de>
date Mon, 19 Dec 2011 17:15:10 +0100
parents 6a367b5d9a2d
children 23bcca1c3687
files SSR.h SSR_PluginFns.c SSR_Request_Handlers.c SSR_lib.c dependency.c dependency.h
diffstat 6 files changed, 62 insertions(+), 30 deletions(-) [+]
line diff
     1.1 --- a/SSR.h	Mon Dec 05 19:00:51 2011 +0100
     1.2 +++ b/SSR.h	Mon Dec 19 17:15:10 2011 +0100
     1.3 @@ -108,10 +108,8 @@
     1.4     #ifdef OBSERVE_UCC
     1.5     Unit*** unitcollection;
     1.6     PrivDynArrayInfo* unitcollectionInfo;
     1.7 -   Dependency** ctlDependencies;
     1.8 -   PrivDynArrayInfo* ctlDependenciesInfo;
     1.9 -   Dependency** commDependencies;
    1.10 -   PrivDynArrayInfo* commDependenciesInfo;
    1.11 +   ListOfArrays* ctlDependenciesList;
    1.12 +   ListOfArrays* commDependenciesList;
    1.13     //NtoN structure?
    1.14     #endif
    1.15     
     2.1 --- a/SSR_PluginFns.c	Mon Dec 05 19:00:51 2011 +0100
     2.2 +++ b/SSR_PluginFns.c	Mon Dec 19 17:15:10 2011 +0100
     2.3 @@ -210,7 +210,12 @@
     2.4     DEBUG1(dbgRqstHdlr,"(new VP: %d)\n",newPr->procrID)
     2.5  
     2.6     #ifdef OBSERVE_UCC
     2.7 -   addToDynArray((void*)new_dependency(requestingPr->procrID,requestingPr->numTimesScheduled,newPr->procrID,0),semEnv->commDependenciesInfo);     
     2.8 +   Dependency newd;
     2.9 +   newd.from_vp = requestingPr->procrID;
    2.10 +   newd.from_task = requestingPr->numTimesScheduled;
    2.11 +   newd.to_vp = newPr->procrID;
    2.12 +   newd.to_task = 0;
    2.13 +   addToListOfArrays(Dependency,newd,semEnv->commDependenciesList);   
    2.14     #endif
    2.15  
    2.16        //For SSR, caller needs ptr to created processor returned to it
    2.17 @@ -231,9 +236,12 @@
    2.18     saveLowTimeStampCountInto(lastRecord->unblocked_timestamp);
    2.19     #endif
    2.20     #ifdef OBSERVE_UCC
    2.21 -   Dependency* newd = new_dependency(procr->procrID,procr->numTimesScheduled,
    2.22 -                                     procr->procrID,procr->numTimesScheduled + 1);
    2.23 -   addToDynArray((void*) newd ,semEnv->ctlDependenciesInfo);   
    2.24 +   Dependency newd;
    2.25 +   newd.from_vp = procr->procrID;
    2.26 +   newd.from_task = procr->numTimesScheduled;
    2.27 +   newd.to_vp = procr->procrID;
    2.28 +   newd.to_task = procr->numTimesScheduled + 1;
    2.29 +   addToListOfArrays(Dependency, newd ,semEnv->ctlDependenciesList);   
    2.30     #endif
    2.31     writePrivQ( procr, semEnv->readyVPQs[ procr->coreAnimatedBy] );
    2.32   }
     3.1 --- a/SSR_Request_Handlers.c	Mon Dec 05 19:00:51 2011 +0100
     3.2 +++ b/SSR_Request_Handlers.c	Mon Dec 19 17:15:10 2011 +0100
     3.3 @@ -127,8 +127,12 @@
     3.4     else
     3.5      {    
     3.6         #ifdef OBSERVE_UCC
     3.7 -       addToDynArray((void*)new_dependency(sendPr->procrID,sendPr->numTimesScheduled,
     3.8 -                receivePr->procrID,receivePr->numTimesScheduled +1),semEnv->commDependenciesInfo);     
     3.9 +        Dependency newd;
    3.10 +        newd.from_vp = sendPr->procrID;
    3.11 +        newd.from_task = sendPr->numTimesScheduled;
    3.12 +        newd.to_vp = receivePr->procrID;
    3.13 +        newd.to_task = receivePr->numTimesScheduled +1;
    3.14 +        addToListOfArrays(Dependency,newd,semEnv->commDependenciesList);       
    3.15         #endif
    3.16  
    3.17         //waiting request is a receive, so it pairs to this send
    3.18 @@ -188,9 +192,12 @@
    3.19     else
    3.20      {    //waiting request is a receive, so it completes pair with this send
    3.21        #ifdef OBSERVE_UCC
    3.22 -      addToDynArray((void*) new_dependency(sendPr->procrID,sendPr->numTimesScheduled,
    3.23 -                                          receivePr->procrID,receivePr->numTimesScheduled +1)
    3.24 -                    ,semEnv->commDependenciesInfo);     
    3.25 +        Dependency newd;
    3.26 +        newd.from_vp = sendPr->procrID;
    3.27 +        newd.from_task = sendPr->numTimesScheduled;
    3.28 +        newd.to_vp = receivePr->procrID;
    3.29 +        newd.to_task = receivePr->numTimesScheduled +1;
    3.30 +        addToListOfArrays(Dependency,newd,semEnv->commDependenciesList);   
    3.31        #endif 
    3.32           //First, remove the waiting receive request from the entry
    3.33        entry->content = waitingReq->nextReqInHashEntry;
    3.34 @@ -293,8 +300,12 @@
    3.35        VMS__free( waitingReq );
    3.36  
    3.37         #ifdef OBSERVE_UCC
    3.38 -       addToDynArray((void*)new_dependency(sendPr->procrID,sendPr->numTimesScheduled,
    3.39 -                receivePr->procrID,receivePr->numTimesScheduled +1),semEnv->commDependenciesInfo);     
    3.40 +        Dependency newd;
    3.41 +        newd.from_vp = sendPr->procrID;
    3.42 +        newd.from_task = sendPr->numTimesScheduled;
    3.43 +        newd.to_vp = receivePr->procrID;
    3.44 +        newd.to_task = receivePr->numTimesScheduled +1;
    3.45 +        addToListOfArrays(Dependency,newd,semEnv->commDependenciesList);      
    3.46         #endif
    3.47        
    3.48        resume_procr( sendPr,    semEnv );
    3.49 @@ -334,9 +345,12 @@
    3.50     if( waitingReq->reqType == send_from_to )
    3.51      {    //waiting request is a send, so pair it with this receive
    3.52        #ifdef OBSERVE_UCC
    3.53 -      addToDynArray((void*) new_dependency(sendPr->procrID,sendPr->numTimesScheduled,
    3.54 -                                          receivePr->procrID,receivePr->numTimesScheduled +1)
    3.55 -                    ,semEnv->commDependenciesInfo);     
    3.56 +        Dependency newd;
    3.57 +        newd.from_vp = sendPr->procrID;
    3.58 +        newd.from_task = sendPr->numTimesScheduled;
    3.59 +        newd.to_vp = receivePr->procrID;
    3.60 +        newd.to_task = receivePr->numTimesScheduled +1;
    3.61 +        addToListOfArrays(Dependency,newd,semEnv->commDependenciesList);    
    3.62        #endif  
    3.63           //For from-to, should only ever be a single reqst waiting tobe paird
    3.64        entry->content = waitingReq->nextReqInHashEntry;
     4.1 --- a/SSR_lib.c	Mon Dec 05 19:00:51 2011 +0100
     4.2 +++ b/SSR_lib.c	Mon Dec 19 17:15:10 2011 +0100
     4.3 @@ -211,10 +211,8 @@
     4.4     
     4.5     #ifdef OBSERVE_UCC
     4.6     //TODO: set up unit recording structure
     4.7 -   semanticEnv->ctlDependencies = VMS__malloc(10*sizeof(void*));
     4.8 -   semanticEnv->ctlDependenciesInfo = makePrivDynArrayInfoFrom((void***)&(semanticEnv->ctlDependencies),10);
     4.9 -   semanticEnv->commDependencies = VMS__malloc(10*sizeof(void*));
    4.10 -   semanticEnv->commDependenciesInfo = makePrivDynArrayInfoFrom((void***)&(semanticEnv->commDependencies),10);
    4.11 +   semanticEnv->ctlDependenciesList = makeListOfArrays(sizeof(Dependency),128);
    4.12 +   semanticEnv->commDependenciesList = makeListOfArrays(sizeof(Dependency),128);
    4.13     //TODO: set up N:N recording structure
    4.14     #endif
    4.15  
    4.16 @@ -255,7 +253,6 @@
    4.17  void
    4.18  SSR__cleanup_after_shutdown()
    4.19   { SSRSemEnv *semanticEnv;
    4.20 -   int coreIdx;
    4.21     
    4.22     semanticEnv = _VMSMasterEnv->semanticEnv;
    4.23  
    4.24 @@ -279,13 +276,14 @@
    4.25      output = fopen(filename,"w+");
    4.26      if(output!=NULL){
    4.27          set_dependency_file(output);
    4.28 -        fprintf(output,"digraph Dependencies {\n");
    4.29 -        set_dot_file(output);
    4.30 +        //fprintf(output,"digraph Dependencies {\n");
    4.31 +        //set_dot_file(output);
    4.32          //FIXME:  first line still depends on counters being enabled, replace w/ unit struct!
    4.33 -        forAllInDynArrayDo(_VMSMasterEnv->counter_history_array_info, &print_dot_node_info );
    4.34 -        forAllInDynArrayDo( semanticEnv->commDependenciesInfo, &print_dependency_to_file );
    4.35 -        forAllInDynArrayDo( semanticEnv->ctlDependenciesInfo, &print_dependency_to_file );
    4.36 -        fprintf(output,"}\n");
    4.37 +        //forAllInDynArrayDo(_VMSMasterEnv->counter_history_array_info, &print_dot_node_info );
    4.38 +        forAllInListOfArraysDo( semanticEnv->commDependenciesList, &print_comm_dependency_to_file );
    4.39 +        forAllInListOfArraysDo( semanticEnv->ctlDependenciesList, &print_ctl_dependency_to_file );
    4.40 +        //fprintf(output,"}\n");
    4.41 +        fflush(output);
    4.42      } else
    4.43          printf("Opening Dependencies file failed. Please check that folder \"counters\" exists in run directory and has write permission.\n");
    4.44     } else {
     5.1 --- a/dependency.c	Mon Dec 05 19:00:51 2011 +0100
     5.2 +++ b/dependency.c	Mon Dec 19 17:15:10 2011 +0100
     5.3 @@ -16,6 +16,16 @@
     5.4      dependency_file = file;
     5.5  }
     5.6  
     5.7 +void print_ctl_dependency_to_file(void* _dep){
     5.8 +    Dependency* dep = (Dependency*) _dep;
     5.9 +    fprintf(dependency_file,"ctlDep,%d,%d,%d,%d\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
    5.10 +}
    5.11 +
    5.12 +void print_comm_dependency_to_file(void* _dep){
    5.13 +    Dependency* dep = (Dependency*) _dep;
    5.14 +    fprintf(dependency_file,"commDep,%d,%d,%d,%d\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
    5.15 +}
    5.16 +
    5.17  void print_dependency_to_file(void* _dep){
    5.18      Dependency* dep = (Dependency*) _dep;
    5.19      fprintf(dependency_file,"VP_%d_%d -> VP_%d_%d;\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
     6.1 --- a/dependency.h	Mon Dec 05 19:00:51 2011 +0100
     6.2 +++ b/dependency.h	Mon Dec 19 17:15:10 2011 +0100
     6.3 @@ -1,6 +1,6 @@
     6.4  /* 
     6.5   * File:   dependency.h
     6.6 - * Author: engelhardt
     6.7 + * Author: Nina Engelhardt
     6.8   *
     6.9   * Created on 29. August 2011, 17:41
    6.10   */
    6.11 @@ -29,6 +29,10 @@
    6.12  
    6.13  int set_dependency_file(FILE* file);
    6.14  
    6.15 +void print_ctl_dependency_to_file(void* _dep);
    6.16 +
    6.17 +void print_comm_dependency_to_file(void* _dep);
    6.18 +
    6.19  void print_dependency_to_file(void* dep);
    6.20  
    6.21  #endif	/* DEPENDENCY_H */