Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
diff loop.c @ 166:aefd87f9d12f
loop graph
| author | Nina Engelhardt |
|---|---|
| date | Tue, 18 Oct 2011 15:53:04 +0200 |
| parents | |
| children | 3bd35fc83c61 |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/loop.c Tue Oct 18 15:53:04 2011 +0200 1.3 @@ -0,0 +1,55 @@ 1.4 +#include "VMS.h" 1.5 +#include "vmalloc.h" 1.6 +#include "loop.h" 1.7 + 1.8 +bulb new_bulb() { 1.9 + bulb b = VMS__malloc((2*NUM_SCHED_SLOTS + 2)*sizeof(int)); 1.10 + memset(b,0,(2*NUM_SCHED_SLOTS + 2)*sizeof(int)); 1.11 + return b; 1.12 +} 1.13 + 1.14 +void set_bulb_member(bulb b, int i, int vp, int task){ 1.15 + b[2*i]=vp; 1.16 + b[2*i+1]=task; 1.17 +} 1.18 + 1.19 +void set_bulb_core(bulb b, int core){ 1.20 + b[2*NUM_SCHED_SLOTS] = core; 1.21 +} 1.22 + 1.23 +void set_bulb_id(bulb b, int id){ 1.24 + b[2*NUM_SCHED_SLOTS + 1] = id; 1.25 +} 1.26 + 1.27 +void set_loop_file(FILE* file){ 1.28 + loop_file=file; 1.29 +} 1.30 + 1.31 +void print_bulb_to_file(void* _b){ 1.32 + bulb b = (bulb) _b; 1.33 + if(b[2*NUM_SCHED_SLOTS]!=0 || b[2*NUM_SCHED_SLOTS + 1]!=0) 1.34 + fprintf(loop_file,"sync%d_%d [shape=rect];\n",b[2*NUM_SCHED_SLOTS],b[2*NUM_SCHED_SLOTS + 1]); 1.35 + int i; 1.36 + for(i=0;i<NUM_SCHED_SLOTS;++i){ 1.37 + if(b[2*i] != 0){ 1.38 + 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]); 1.39 + 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); 1.40 + } 1.41 + } 1.42 +} 1.43 + 1.44 +int prev_slots[NUM_CORES][2*NUM_SCHED_SLOTS]; 1.45 + 1.46 +void print_per_slot_to_file(void* _b){ 1.47 + bulb b = (bulb) _b; 1.48 + int i; 1.49 + for(i=0;i<NUM_SCHED_SLOTS;++i){ 1.50 + if(b[2*i] != 0){ 1.51 + if(prev_slots[b[2*NUM_SCHED_SLOTS]][2*i] != 0){ 1.52 + 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]); 1.53 + } 1.54 + prev_slots[b[2*NUM_SCHED_SLOTS]][2*i] = b[2*i]; 1.55 + prev_slots[b[2*NUM_SCHED_SLOTS]][2*i+1] = b[2*i+1]; 1.56 + } 1.57 + } 1.58 +} 1.59 \ No newline at end of file
