VMS/VMS_Implementations/SSR_impls/SSR__MC_shared_impl

view dependency.c @ 84:ce07f1a42ddf

Added skeleton for data tracking assigner + design notes
author Sean Halle <seanhalle@yahoo.com>
date Thu, 10 Jan 2013 11:16:42 -0800
parents f20b4d9d3086
children
line source
1 #include "dependency.h"
2 #include "VMS_impl/VMS.h"
4 Dependency* new_dependency(int from_vp, int from_task, int to_vp, int to_task){
5 Dependency* newDep = (Dependency*) VMS_int__malloc(sizeof(Dependency));
6 if (newDep!=NULL){
7 newDep->from_vp = from_vp;
8 newDep->from_task = from_task;
9 newDep->to_vp = to_vp;
10 newDep->to_task = to_task;
11 }
12 return newDep;
13 }
15 NtoN* new_NtoN(int id){
16 NtoN* newn = (NtoN*) VMS_int__malloc(sizeof(NtoN));
17 newn->id = id;
18 newn->senders = makeListOfArrays(sizeof(Unit), 64);
19 newn->receivers = makeListOfArrays(sizeof(Unit), 64);
20 return newn;
21 }
23 int set_dependency_file(FILE* file){
24 dependency_file = file;
25 }
27 void print_ctl_dependency_to_file(void* _dep){
28 Dependency* dep = (Dependency*) _dep;
29 if(!dep) return;
30 fprintf(dependency_file,"ctlDep,%d,%d,%d,%d\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
31 }
33 void print_comm_dependency_to_file(void* _dep){
34 Dependency* dep = (Dependency*) _dep;
35 if(!dep) return;
36 fprintf(dependency_file,"commDep,%d,%d,%d,%d\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
37 }
39 void print_dyn_dependency_to_file(void* _dep){
40 Dependency* dep = (Dependency*) _dep;
41 if(!dep) return;
42 fprintf(dependency_file,"dynDep,%d,%d,%d,%d\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
43 }
45 void print_singleton_dependency_to_file(void* _dep){
46 Dependency* dep = (Dependency*) _dep;
47 if(!dep) return;
48 fprintf(dependency_file,"singDep,%d,%d,%d,%d\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
49 }
51 void print_hw_dependency_to_file(void* _dep){
52 Dependency* dep = (Dependency*) _dep;
53 if(!dep) return;
54 fprintf(dependency_file,"hwDep,%d,%d,%d,%d\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
55 }
57 void print_dependency_to_file(void* _dep){
58 Dependency* dep = (Dependency*) _dep;
59 if(!dep) return;
60 fprintf(dependency_file,"VP_%d_%d -> VP_%d_%d;\n",dep->from_vp,dep->from_task,dep->to_vp,dep->to_task);
61 }
63 void print_unit_to_file(void* _unit){
64 Unit* unit = (Unit*) _unit;
65 if(!unit) return;
66 fprintf(dependency_file,"unit,%d,%d,%p,%d\n",unit->vp,unit->task,unit->ret_ptr,unit->reqType);
67 }
69 void print_nton_set_helper(void* _u){
70 Unit* u = (Unit*) _u;
71 if(!u) return;
72 fprintf(dependency_file,",%d,%d",u->vp,u->task);
73 }
75 void print_nton_to_file(void* _nton){
76 NtoN* nton = (NtoN*) _nton;
77 if(!nton) return;
78 //assert(nton->senders->next_free_index==nton->receivers->next_free_index);
79 int numInSet = nton->senders->next_free_index;
80 fprintf(dependency_file,"NtoN,%d",numInSet);
81 forAllInListOfArraysDo(nton->senders,&print_nton_set_helper);
82 forAllInListOfArraysDo(nton->receivers,&print_nton_set_helper);
83 fprintf(dependency_file,"\n");
84 }