Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
view loop.c @ 166:aefd87f9d12f
loop graph
| author | Nina Engelhardt |
|---|---|
| date | Tue, 18 Oct 2011 15:53:04 +0200 |
| parents | |
| children | 3bd35fc83c61 |
line source
1 #include "VMS.h"
2 #include "vmalloc.h"
3 #include "loop.h"
5 bulb new_bulb() {
6 bulb b = VMS__malloc((2*NUM_SCHED_SLOTS + 2)*sizeof(int));
7 memset(b,0,(2*NUM_SCHED_SLOTS + 2)*sizeof(int));
8 return b;
9 }
11 void set_bulb_member(bulb b, int i, int vp, int task){
12 b[2*i]=vp;
13 b[2*i+1]=task;
14 }
16 void set_bulb_core(bulb b, int core){
17 b[2*NUM_SCHED_SLOTS] = core;
18 }
20 void set_bulb_id(bulb b, int id){
21 b[2*NUM_SCHED_SLOTS + 1] = id;
22 }
24 void set_loop_file(FILE* file){
25 loop_file=file;
26 }
28 void print_bulb_to_file(void* _b){
29 bulb b = (bulb) _b;
30 if(b[2*NUM_SCHED_SLOTS]!=0 || b[2*NUM_SCHED_SLOTS + 1]!=0)
31 fprintf(loop_file,"sync%d_%d [shape=rect];\n",b[2*NUM_SCHED_SLOTS],b[2*NUM_SCHED_SLOTS + 1]);
32 int i;
33 for(i=0;i<NUM_SCHED_SLOTS;++i){
34 if(b[2*i] != 0){
35 fprintf(loop_file, "sync%d_%d -> VP_%d_%d;\n",b[2*NUM_SCHED_SLOTS],b[2*NUM_SCHED_SLOTS + 1],b[2*i],b[2*i+1]);
36 fprintf(loop_file, "VP_%d_%d -> sync%d_%d;\n",b[2*i],b[2*i+1],b[2*NUM_SCHED_SLOTS],b[2*NUM_SCHED_SLOTS + 1] + 1);
37 }
38 }
39 }
41 int prev_slots[NUM_CORES][2*NUM_SCHED_SLOTS];
43 void print_per_slot_to_file(void* _b){
44 bulb b = (bulb) _b;
45 int i;
46 for(i=0;i<NUM_SCHED_SLOTS;++i){
47 if(b[2*i] != 0){
48 if(prev_slots[b[2*NUM_SCHED_SLOTS]][2*i] != 0){
49 fprintf(loop_file, "VP_%d_%d -> 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]);
50 }
51 prev_slots[b[2*NUM_SCHED_SLOTS]][2*i] = b[2*i];
52 prev_slots[b[2*NUM_SCHED_SLOTS]][2*i+1] = b[2*i+1];
53 }
54 }
55 }
