Commit 642231b0 authored by Misbah Mubarak's avatar Misbah Mubarak

minor updates to sampling statistics

parent 47aed8d9
...@@ -1314,7 +1314,7 @@ int main( int argc, char** argv ) ...@@ -1314,7 +1314,7 @@ int main( int argc, char** argv )
net_id = *net_ids; net_id = *net_ids;
free(net_ids); free(net_ids);
model_net_enable_sampling(5000000, 8000000); // model_net_enable_sampling(5000000, 3000000000);
codes_mapping_setup(); codes_mapping_setup();
......
...@@ -1991,17 +1991,17 @@ void dragonfly_rsample_fin(router_state * s, ...@@ -1991,17 +1991,17 @@ void dragonfly_rsample_fin(router_state * s,
p->radix, p->radix); p->radix, p->radix);
fclose(fp); fclose(fp);
} }
char cn_fn[MAX_NAME_LENGTH]; char rt_fn[MAX_NAME_LENGTH];
if(strcmp(router_sample_file, "") == 0) if(strcmp(router_sample_file, "") == 0)
sprintf(cn_fn, "dragonfly-router-sampling-%ld.bin", g_tw_mynode); sprintf(rt_fn, "dragonfly-router-sampling-%ld.bin", g_tw_mynode);
else else
sprintf(cn_fn, "%s-%ld.bin", router_sample_file, g_tw_mynode); sprintf(rt_fn, "%s-%ld.bin", router_sample_file, g_tw_mynode);
int i = 0; int i = 0;
int j = 0; int j = 0;
int size_sample = sizeof(tw_lpid) + p->radix * (sizeof(int64_t) + sizeof(tw_stime)) + sizeof(tw_stime); int size_sample = sizeof(tw_lpid) + p->radix * (sizeof(int64_t) + sizeof(tw_stime)) + sizeof(tw_stime);
FILE * fp = fopen(cn_fn, "a"); FILE * fp = fopen(rt_fn, "a");
fseek(fp, sample_rtr_bytes_written, SEEK_SET); fseek(fp, sample_rtr_bytes_written, SEEK_SET);
for(; i < s->op_arr_size; i++) for(; i < s->op_arr_size; i++)
...@@ -3012,6 +3012,7 @@ void router_buf_update(router_state * s, tw_bf * bf, terminal_message * msg, tw_ ...@@ -3012,6 +3012,7 @@ void router_buf_update(router_state * s, tw_bf * bf, terminal_message * msg, tw_
msg->saved_busy_time = s->last_buf_full[indx]; msg->saved_busy_time = s->last_buf_full[indx];
msg->saved_sample_time = s->busy_time_sample[indx]; msg->saved_sample_time = s->busy_time_sample[indx];
s->busy_time[indx] += (tw_now(lp) - s->last_buf_full[indx]); s->busy_time[indx] += (tw_now(lp) - s->last_buf_full[indx]);
s->busy_time_sample[indx] += (tw_now(lp) - s->last_buf_full[indx]);
s->last_buf_full[indx] = 0.0; s->last_buf_full[indx] = 0.0;
} }
if(s->queued_msgs[indx][output_chan] != NULL) { if(s->queued_msgs[indx][output_chan] != NULL) {
......
...@@ -53,7 +53,7 @@ int main( int argc, char** argv ) ...@@ -53,7 +53,7 @@ int main( int argc, char** argv )
char buffer_read[64]; char buffer_read[64];
char buffer_write[64]; char buffer_write[64];
sprintf(buffer_read, "dragonfly-sample-ur-%d.bin", my_rank); sprintf(buffer_read, "dragonfly-cn-sampling-%d.bin", my_rank);
pFile = fopen(buffer_read, "r+"); pFile = fopen(buffer_read, "r+");
struct stat st; struct stat st;
...@@ -62,7 +62,7 @@ int main( int argc, char** argv ) ...@@ -62,7 +62,7 @@ int main( int argc, char** argv )
event_array = malloc(in_sz); event_array = malloc(in_sz);
sprintf(buffer_write, "dragonfly-write-log.%d", my_rank); sprintf(buffer_write, "dragonfly-write-log.%d", my_rank);
writeFile = fopen(buffer_write, "w+"); writeFile = fopen(buffer_write, "w");
if(pFile == NULL || writeFile == NULL) if(pFile == NULL || writeFile == NULL)
{ {
...@@ -74,6 +74,7 @@ int main( int argc, char** argv ) ...@@ -74,6 +74,7 @@ int main( int argc, char** argv )
fprintf(writeFile, " Rank ID \t Finished chunks \t Data size \t Finished hops \t Time spent \t Busy time \t Sample end time"); fprintf(writeFile, " Rank ID \t Finished chunks \t Data size \t Finished hops \t Time spent \t Busy time \t Sample end time");
for(i = 0; i < in_sz / sizeof(struct dfly_samples); i++) for(i = 0; i < in_sz / sizeof(struct dfly_samples); i++)
{ {
printf("\n Terminal id %ld ", event_array[i].terminal_id);
fprintf(writeFile, "\n %ld \t %ld \t %ld \t %lf \t %lf \t %lf \t %lf ", event_array[i].terminal_id, fprintf(writeFile, "\n %ld \t %ld \t %ld \t %lf \t %lf \t %lf \t %lf ", event_array[i].terminal_id,
event_array[i].fin_chunks_sample, event_array[i].fin_chunks_sample,
event_array[i].data_size_sample, event_array[i].data_size_sample,
...@@ -90,7 +91,7 @@ int main( int argc, char** argv ) ...@@ -90,7 +91,7 @@ int main( int argc, char** argv )
char buffer_rtr_read[64]; char buffer_rtr_read[64];
char buffer_rtr_write[64]; char buffer_rtr_write[64];
sprintf(buffer_rtr_read, "dragonfly-router-ur-%d.bin", my_rank); sprintf(buffer_rtr_read, "dragonfly-router-sampling-%d.bin", my_rank);
pFile = fopen(buffer_rtr_read, "r+"); pFile = fopen(buffer_rtr_read, "r+");
struct stat st2; struct stat st2;
...@@ -101,7 +102,7 @@ int main( int argc, char** argv ) ...@@ -101,7 +102,7 @@ int main( int argc, char** argv )
int sample_size = sizeof(struct dfly_rtr_sample); int sample_size = sizeof(struct dfly_rtr_sample);
sprintf(buffer_rtr_write, "dragonfly-rtr-write-log.%d", my_rank); sprintf(buffer_rtr_write, "dragonfly-rtr-write-log.%d", my_rank);
writeRouterFile = fopen(buffer_rtr_write, "w+"); writeRouterFile = fopen(buffer_rtr_write, "w");
if(writeRouterFile == NULL || pFile == NULL) if(writeRouterFile == NULL || pFile == NULL)
{ {
...@@ -112,7 +113,7 @@ int main( int argc, char** argv ) ...@@ -112,7 +113,7 @@ int main( int argc, char** argv )
fseek(pFile, 0L, SEEK_SET); fseek(pFile, 0L, SEEK_SET);
fread(r_event_array, sample_size, in_sz_rt / sample_size, pFile); fread(r_event_array, sample_size, in_sz_rt / sample_size, pFile);
fprintf(writeRouterFile, "\n Router ID \t Busy time per channel \t Link traffic per channel \t Sample end time "); fprintf(writeRouterFile, "\n Router ID \t Busy time per channel \t Link traffic per channel \t Sample end time ");
printf("\n Sample size %d in_sz_rt %ld ", in_sz_rt / sample_size, in_sz_rt); //printf("\n Sample size %d in_sz_rt %ld ", in_sz_rt / sample_size, in_sz_rt);
for(i = 0; i < in_sz_rt / sample_size; i++) for(i = 0; i < in_sz_rt / sample_size; i++)
{ {
//printf("\n %ld ", r_event_array[i].router_id); //printf("\n %ld ", r_event_array[i].router_id);
...@@ -125,8 +126,10 @@ int main( int argc, char** argv ) ...@@ -125,8 +126,10 @@ int main( int argc, char** argv )
} }
for(j = 0; j < RADIX; j++ ) for(j = 0; j < RADIX; j++ )
{
//printf("\n link traffic %ld ", r_event_array[i].link_traffic[j]);
fprintf(writeRouterFile, " %ld ", r_event_array[i].link_traffic[j]); fprintf(writeRouterFile, " %ld ", r_event_array[i].link_traffic[j]);
}
fprintf(writeRouterFile, "\n %lf ", r_event_array[i].end_time); fprintf(writeRouterFile, "\n %lf ", r_event_array[i].end_time);
} }
fclose(pFile); fclose(pFile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment