Commit 8ae7fb49 authored by Noah Wolfe's avatar Noah Wolfe
Browse files

Fixing slimfly indentation

parent 0592e2a4
......@@ -49,12 +49,12 @@
#define N_COLLECT_POINTS 100
/*unsigned long terminal_sends[TEMP_NUM_TERMINALS][N_COLLECT_POINTS];
unsigned long terminal_recvs[TEMP_NUM_TERMINALS][N_COLLECT_POINTS];
unsigned long router_sends[TEMP_NUM_ROUTERS][N_COLLECT_POINTS];
unsigned long router_recvs[TEMP_NUM_ROUTERS][N_COLLECT_POINTS];
int vc_occupancy_storage_router[TEMP_NUM_ROUTERS][TEMP_RADIX][TEMP_NUM_VC][N_COLLECT_POINTS];
int vc_occupancy_storage_terminal[TEMP_NUM_TERMINALS][TEMP_NUM_VC][N_COLLECT_POINTS];
*/FILE * slimfly_terminal_sends_recvs_log = NULL;
unsigned long terminal_recvs[TEMP_NUM_TERMINALS][N_COLLECT_POINTS];
unsigned long router_sends[TEMP_NUM_ROUTERS][N_COLLECT_POINTS];
unsigned long router_recvs[TEMP_NUM_ROUTERS][N_COLLECT_POINTS];
int vc_occupancy_storage_router[TEMP_NUM_ROUTERS][TEMP_RADIX][TEMP_NUM_VC][N_COLLECT_POINTS];
int vc_occupancy_storage_terminal[TEMP_NUM_TERMINALS][TEMP_NUM_VC][N_COLLECT_POINTS];
*/FILE * slimfly_terminal_sends_recvs_log = NULL;
FILE * slimfly_router_sends_recvs_log = NULL;
FILE * slimfly_router_occupancy_log=NULL;
FILE * slimfly_terminal_occupancy_log=NULL;
......@@ -109,7 +109,7 @@ struct slim_terminal_message_list {
};
void slim_init_terminal_message_list(slim_terminal_message_list *this,
slim_terminal_message *inmsg) {
slim_terminal_message *inmsg) {
this->msg = *inmsg;
this->event_data = NULL;
this->next = NULL;
......@@ -144,10 +144,10 @@ struct slimfly_param
double local_delay;
double global_delay;
double credit_delay;
//slimfly added
double router_delay; /*Router processing delay moving packet from input port to output port*/
double link_delay; /*Network link latency. Currently encorporated into the arrival time*/
int num_local_channels;
//slimfly added
double router_delay; /*Router processing delay moving packet from input port to output port*/
double link_delay; /*Network link latency. Currently encorporated into the arrival time*/
int num_local_channels;
};
struct sfly_hash_key
......@@ -158,11 +158,11 @@ struct sfly_hash_key
struct sfly_qhash_entry
{
struct sfly_hash_key key;
char * remote_event_data;
int num_chunks;
int remote_event_size;
struct qhash_head hash_link;
struct sfly_hash_key key;
char * remote_event_data;
int num_chunks;
int remote_event_size;
struct qhash_head hash_link;
};
/* handles terminal and router events like packet generate/send/receive/buffer */
......@@ -173,73 +173,73 @@ typedef struct router_state router_state;
/* slimfly compute node data structure */
struct terminal_state
{
uint64_t packet_counter;
// Dragonfly specific parameters
int router_id;
int terminal_id;
// Each terminal will have an input and output channel with the router
int* vc_occupancy; // NUM_VC
int num_vcs;
tw_stime terminal_available_time;
slim_terminal_message_list **terminal_msgs;
slim_terminal_message_list **terminal_msgs_tail;
int in_send_loop;
// Terminal generate, sends and arrival T_SEND, T_ARRIVAL, T_GENERATE
// Router-Router Intra-group sends and receives RR_LSEND, RR_LARRIVE
// Router-Router Inter-group sends and receives RR_GSEND, RR_GARRIVE
struct mn_stats slimfly_stats_array[CATEGORY_MAX];
struct rc_stack * st;
int issueIdle;
int terminal_length;
const char * anno;
const slimfly_param *params;
struct qhash_table *rank_tbl;
uint64_t rank_tbl_pop;
tw_stime total_time;
long total_msg_size;
long total_hops;
long finished_msgs;
long finished_chunks;
long finished_packets;
tw_stime last_buf_full;
tw_stime busy_time;
char output_buf[512];
uint64_t packet_counter;
// Dragonfly specific parameters
int router_id;
int terminal_id;
// Each terminal will have an input and output channel with the router
int* vc_occupancy; // NUM_VC
int num_vcs;
tw_stime terminal_available_time;
slim_terminal_message_list **terminal_msgs;
slim_terminal_message_list **terminal_msgs_tail;
int in_send_loop;
// Terminal generate, sends and arrival T_SEND, T_ARRIVAL, T_GENERATE
// Router-Router Intra-group sends and receives RR_LSEND, RR_LARRIVE
// Router-Router Inter-group sends and receives RR_GSEND, RR_GARRIVE
struct mn_stats slimfly_stats_array[CATEGORY_MAX];
struct rc_stack * st;
int issueIdle;
int terminal_length;
const char * anno;
const slimfly_param *params;
struct qhash_table *rank_tbl;
uint64_t rank_tbl_pop;
tw_stime total_time;
long total_msg_size;
long total_hops;
long finished_msgs;
long finished_chunks;
long finished_packets;
tw_stime last_buf_full;
tw_stime busy_time;
char output_buf[512];
};
/* terminal event type (1-4) */
enum event_t
{
T_GENERATE=1,
T_ARRIVE,
T_SEND,
T_BUFFER,
R_SEND,
R_ARRIVE,
R_BUFFER
T_GENERATE=1,
T_ARRIVE,
T_SEND,
T_BUFFER,
R_SEND,
R_ARRIVE,
R_BUFFER
};
/* status of a virtual channel can be idle, active, allocated or wait for credit */
enum vc_status
{
VC_IDLE,
VC_ACTIVE,
VC_ALLOC,
VC_CREDIT
VC_IDLE,
VC_ACTIVE,
VC_ALLOC,
VC_CREDIT
};
/* whether the last hop of a packet was global, local or a terminal */
enum last_hop
{
GLOBAL,
LOCAL,
TERMINAL
GLOBAL,
LOCAL,
TERMINAL
};
/* three forms of routing algorithms available, adaptive routing is not
......@@ -254,34 +254,34 @@ enum ROUTING_ALGO
struct router_state
{
int router_id;
int group_id;
int router_id;
int group_id;
int* global_channel;
int* local_channel;
int* global_channel;
int* local_channel;
tw_stime* next_output_available_time;
slim_terminal_message_list ***pending_msgs;
slim_terminal_message_list ***pending_msgs_tail;
slim_terminal_message_list ***queued_msgs;
slim_terminal_message_list ***queued_msgs_tail;
int *in_send_loop;
tw_stime* next_output_available_time;
slim_terminal_message_list ***pending_msgs;
slim_terminal_message_list ***pending_msgs_tail;
slim_terminal_message_list ***queued_msgs;
slim_terminal_message_list ***queued_msgs_tail;
int *in_send_loop;
tw_stime* last_buf_full;
tw_stime* busy_time;
tw_stime* busy_time_sample;
tw_stime* last_buf_full;
tw_stime* busy_time;
tw_stime* busy_time_sample;
char output_buf[4096];
char output_buf2[4096];
char output_buf[4096];
char output_buf2[4096];
int** vc_occupancy;
int* link_traffic; //Aren't used
int** vc_occupancy;
int* link_traffic; //Aren't used
const char * anno;
const slimfly_param *params;
const char * anno;
const slimfly_param *params;
int* prev_hist_num; //Aren't used
int* cur_hist_num; //Aren't used
int* prev_hist_num; //Aren't used
int* cur_hist_num; //Aren't used
};
static short routing = MINIMAL;
......@@ -311,12 +311,12 @@ static int slimfly_rank_hash_compare(
}
static int slimfly_hash_func(void *k, int table_size)
{
struct sfly_hash_key *tmp = (struct sfly_hash_key *)k;
uint64_t key = (~tmp->message_id) + (tmp->message_id << 18);
key = key * 21;
key = ~key ^ (tmp->sender_id >> 4);
key = key * tmp->sender_id;
return (int)(key % table_size);
struct sfly_hash_key *tmp = (struct sfly_hash_key *)k;
uint64_t key = (~tmp->message_id) + (tmp->message_id << 18);
key = key * 21;
key = ~key ^ (tmp->sender_id >> 4);
key = key * tmp->sender_id;
return (int)(key % table_size);
}
/* convert GiB/s and bytes to ns */
......@@ -337,15 +337,15 @@ static tw_stime bytes_to_ns(uint64_t bytes, double GB_p_s)
/* returns the slimfly message size */
static int slimfly_get_msg_sz(void)
{
return sizeof(slim_terminal_message);
return sizeof(slim_terminal_message);
}
/*static void free_tmp(void * ptr)
{
struct sfly_qhash_entry * sfly = ptr;
free(sfly->remote_event_data);
free(sfly);
}*/
{
struct sfly_qhash_entry * sfly = ptr;
free(sfly->remote_event_data);
free(sfly);
}*/
static void append_to_terminal_message_list(
slim_terminal_message_list ** thisq,
......@@ -381,7 +381,7 @@ static void create_prepend_to_terminal_message_list(
int index,
slim_terminal_message *msg) {
slim_terminal_message_list* new_entry = (slim_terminal_message_list*)malloc(
sizeof(slim_terminal_message_list));
sizeof(slim_terminal_message_list));
slim_init_terminal_message_list(new_entry, msg);
if(msg->remote_event_size_bytes) {
void *m_data = model_net_method_get_edata(SLIMFLY, msg);
......@@ -426,7 +426,7 @@ static slim_terminal_message_list* return_tail(
}
static void copy_terminal_list_entry( slim_terminal_message_list *cur_entry,
slim_terminal_message *msg) {
slim_terminal_message *msg) {
slim_terminal_message *cur_msg = &cur_entry->msg;
msg->travel_start_time = cur_msg->travel_start_time;
msg->packet_ID = cur_msg->packet_ID;
......@@ -451,7 +451,7 @@ static void copy_terminal_list_entry( slim_terminal_message_list *cur_entry,
msg->is_pull = cur_msg->is_pull;
msg->pull_size = cur_msg->pull_size;
msg->intm_group_id = cur_msg->intm_group_id;
msg->intm_router_id = cur_msg->intm_router_id;
msg->intm_router_id = cur_msg->intm_router_id;
msg->chunk_id = cur_msg->chunk_id;
msg->sender_mn_lp = cur_msg->sender_mn_lp;
msg->total_size = cur_msg->total_size;
......@@ -466,7 +466,7 @@ static void copy_terminal_list_entry( slim_terminal_message_list *cur_entry,
if(msg->local_event_size_bytes + msg->remote_event_size_bytes > 0) {
void *m_data = model_net_method_get_edata(SLIMFLY, msg);
memcpy(m_data, cur_entry->event_data,
msg->local_event_size_bytes + msg->remote_event_size_bytes);
msg->local_event_size_bytes + msg->remote_event_size_bytes);
}
}
static void slimfly_read_config(const char * anno, slimfly_param *params){
......@@ -481,7 +481,7 @@ static void slimfly_read_config(const char * anno, slimfly_param *params){
p->num_routers);
}
configuration_get_value_int(&config, "PARAMS", "num_vcs", anno, &p->num_vcs);
configuration_get_value_int(&config, "PARAMS", "num_vcs", anno, &p->num_vcs);
if(!p->num_vcs) {
p->num_vcs = 4;
fprintf(stderr, "Virtual channel size not specified, setting to %d\n", p->num_vcs);
......@@ -547,20 +547,20 @@ static void slimfly_read_config(const char * anno, slimfly_param *params){
fprintf(stderr, "Number of terminals not specified, setting to %d\n", p->num_cn);
}
p->router_delay = -1;
p->router_delay = -1;
configuration_get_value_double(&config, "PARAMS", "router_delay", anno, &p->router_delay);
if(p->router_delay < 0) {
p->router_delay = 0;
fprintf(stderr, "Router delay not specified, setting to %lf\n", p->router_delay);
}
char **values;
char **values;
size_t length;
int ret = configuration_get_multivalue(&config, "PARAMS", "generator_set_X", anno, &values, &length);
int ret = configuration_get_multivalue(&config, "PARAMS", "generator_set_X", anno, &values, &length);
if (ret != 1)
tw_error(TW_LOC, "unable to read PARAMS:generator_set_X\n");
if (length < 2)
fprintf(stderr, "generator set X less than 2 elements\n");
if (length < 2)
fprintf(stderr, "generator set X less than 2 elements\n");
X = (int*)malloc(sizeof(int)*length);
for (size_t i = 0; i < length; i++)
......@@ -569,13 +569,13 @@ static void slimfly_read_config(const char * anno, slimfly_param *params){
}
free(values);
ret = configuration_get_multivalue(&config, "PARAMS", "generator_set_X_prime", anno, &values, &length);
ret = configuration_get_multivalue(&config, "PARAMS", "generator_set_X_prime", anno, &values, &length);
if (ret != 1)
tw_error(TW_LOC, "unable to read PARAMS:generator_set_X_prime\n");
if (length < 2)
fprintf(stderr, "generator set X_prime less than 2 elements\n");
if (length < 2)
fprintf(stderr, "generator set X_prime less than 2 elements\n");
X_size = length;
X_size = length;
X_prime = (int*)malloc(sizeof(int)*length);
for (size_t i = 0; i < length; i++)
{
......@@ -600,16 +600,16 @@ static void slimfly_read_config(const char * anno, slimfly_param *params){
routing = -1;
}
TEMP_RADIX = p->num_local_channels + p->num_global_channels + p->num_cn;
TEMP_NUM_VC = p->num_vcs;
TEMP_RADIX = p->num_local_channels + p->num_global_channels + p->num_cn;
TEMP_NUM_VC = p->num_vcs;
// set the derived parameters
p->num_groups = p->num_routers * 2;
p->radix = (p->num_cn + p->num_global_channels + p->num_local_channels);
p->slim_total_routers = p->num_groups * p->num_routers;
p->slim_total_terminals = p->slim_total_routers * p->num_cn;
slim_total_routers_noah = p->num_groups * p->num_routers;
slim_total_terminals_noah = p->slim_total_routers * p->num_cn;
slim_total_routers_noah = p->num_groups * p->num_routers;
slim_total_terminals_noah = p->slim_total_routers * p->num_cn;
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(!rank) {
......@@ -643,168 +643,168 @@ static void slimfly_configure(){
/* report slimfly statistics like average and maximum packet latency, average number of hops traversed */
static void slimfly_report_stats()
{
long long avg_hops, total_finished_packets, total_finished_chunks;
long long total_finished_msgs, final_msg_sz;
tw_stime avg_time, max_time;
int total_minimal_packets, total_nonmin_packets;
float throughput_avg = 0.0;
float throughput_avg2 = 0.0;
char log[300];
MPI_Reduce( &total_hops, &avg_hops, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &N_finished_packets, &total_finished_packets, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &N_finished_msgs, &total_finished_msgs, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &N_finished_chunks, &total_finished_chunks, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &total_msg_sz, &final_msg_sz, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &slimfly_total_time, &avg_time, 1,MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &slimfly_max_latency, &max_time, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
MPI_Reduce(&pe_throughput_percent, &throughput_avg, 1, MPI_FLOAT, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce(&pe_throughput, &throughput_avg2, 1, MPI_FLOAT, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce(&minimal_count, &total_minimal_packets, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce(&nonmin_count, &total_nonmin_packets, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
/* print statistics */
if(!g_tw_mynode)
{
printf(" Average number of hops traversed %f average chunk latency %lf us maximum chunk latency %lf us avg message size %lf bytes finished messages %lld \n", (float)avg_hops/total_finished_chunks, avg_time/(total_finished_chunks*1000), max_time/1000, (float)final_msg_sz/total_finished_msgs, total_finished_msgs);
long long avg_hops, total_finished_packets, total_finished_chunks;
long long total_finished_msgs, final_msg_sz;
tw_stime avg_time, max_time;
int total_minimal_packets, total_nonmin_packets;
float throughput_avg = 0.0;
float throughput_avg2 = 0.0;
char log[300];
MPI_Reduce( &total_hops, &avg_hops, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &N_finished_packets, &total_finished_packets, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &N_finished_msgs, &total_finished_msgs, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &N_finished_chunks, &total_finished_chunks, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &total_msg_sz, &final_msg_sz, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &slimfly_total_time, &avg_time, 1,MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &slimfly_max_latency, &max_time, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
MPI_Reduce(&pe_throughput_percent, &throughput_avg, 1, MPI_FLOAT, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce(&pe_throughput, &throughput_avg2, 1, MPI_FLOAT, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce(&minimal_count, &total_minimal_packets, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce(&nonmin_count, &total_nonmin_packets, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
/* print statistics */
if(!g_tw_mynode)
{
printf(" Average number of hops traversed %f average chunk latency %lf us maximum chunk latency %lf us avg message size %lf bytes finished messages %lld \n", (float)avg_hops/total_finished_chunks, avg_time/(total_finished_chunks*1000), max_time/1000, (float)final_msg_sz/total_finished_msgs, total_finished_msgs);
#if PARAMS_LOG
throughput_avg = throughput_avg / (float)slim_total_terminals_noah;
throughput_avg2 = throughput_avg2 / (float)slim_total_terminals_noah;
//Open file to append simulation results
sprintf( log, "slimfly-results-log.txt");
slimfly_results_log=fopen(log, "a");
if(slimfly_results_log == NULL)
tw_error(TW_LOC, "\n Failed to open slimfly results log file \n");
printf("Printing Simulation Parameters/Results Log File\n");
fprintf(slimfly_results_log,"%10.3lf, %15.3lf, %11.3lf, %13.3d, %16.3d, %16.3lld, %25.5f, %14.5f, ", (float)avg_hops/total_finished_packets, avg_time/(total_finished_packets),max_time,total_minimal_packets,total_nonmin_packets,total_finished_chunks,throughput_avg*100,throughput_avg2);
fclose(slimfly_results_log);
throughput_avg = throughput_avg / (float)slim_total_terminals_noah;
throughput_avg2 = throughput_avg2 / (float)slim_total_terminals_noah;
//Open file to append simulation results
sprintf( log, "slimfly-results-log.txt");
slimfly_results_log=fopen(log, "a");
if(slimfly_results_log == NULL)
tw_error(TW_LOC, "\n Failed to open slimfly results log file \n");
printf("Printing Simulation Parameters/Results Log File\n");
fprintf(slimfly_results_log,"%10.3lf, %15.3lf, %11.3lf, %13.3d, %16.3d, %16.3lld, %25.5f, %14.5f, ", (float)avg_hops/total_finished_packets, avg_time/(total_finished_packets),max_time,total_minimal_packets,total_nonmin_packets,total_finished_chunks,throughput_avg*100,throughput_avg2);
fclose(slimfly_results_log);
#endif
}
}
#if ROUTER_OCCUPANCY_LOG
if(tw_ismaster())
{
printf("Printing Realtime Router Occupancy Log Files\n");
for(k=0; k<slim_total_routers_noah; k++)
{
sprintf( log, "vc-occupancy/routers/slimfly_router_occupancy_log.%d.txt", k );
slimfly_router_occupancy_log=fopen(log, "w+");
if(slimfly_router_occupancy_log == NULL)
tw_error(TW_LOC, "\n Failed to open slimfly router occupancy log file \n");
for( t=0; t<N_COLLECT_POINTS; t++ )
{
if(t == 0)
{
fprintf(slimfly_router_occupancy_log, "%d, ",t*100/N_COLLECT_POINTS);
}
else
{
fprintf(slimfly_router_occupancy_log, "\n%d, ",t*100/N_COLLECT_POINTS);
}
for( j=0; j<TEMP_RADIX; j++)
{
for(i=0; i<TEMP_NUM_VC; i++)
{
if( k==0 && t==0)
printf("k:%d, j:%d, i:%d, t:%d\n",k,j,i,t);
fprintf(slimfly_router_occupancy_log, "%d, ", vc_occupancy_storage_router[k][j][i][t]);
}
}
}
}
}
fclose(slimfly_router_occupancy_log);
if(tw_ismaster())
{
printf("Printing Realtime Router Occupancy Log Files\n");
for(k=0; k<slim_total_routers_noah; k++)
{
sprintf( log, "vc-occupancy/routers/slimfly_router_occupancy_log.%d.txt", k );
slimfly_router_occupancy_log=fopen(log, "w+");
if(slimfly_router_occupancy_log == NULL)
tw_error(TW_LOC, "\n Failed to open slimfly router occupancy log file \n");
for( t=0; t<N_COLLECT_POINTS; t++ )
{
if(t == 0)
{
fprintf(slimfly_router_occupancy_log, "%d, ",t*100/N_COLLECT_POINTS);
}
else
{
fprintf(slimfly_router_occupancy_log, "\n%d, ",t*100/N_COLLECT_POINTS);
}
for( j=0; j<TEMP_RADIX; j++)
{
for(i=0; i<TEMP_NUM_VC; i++)
{
if( k==0 && t==0)
printf("k:%d, j:%d, i:%d, t:%d\n",k,j,i,t);
fprintf(slimfly_router_occupancy_log, "%d, ", vc_occupancy_storage_router[k][j][i][t]);
}
}
}
}
}
fclose(slimfly_router_occupancy_log);
#endif
#if TERMINAL_OCCUPANCY_LOG
if(tw_ismaster())
{
printf("Printing Realtime Terminal Occupancy Log Files\n");
for(k=0; k<slim_total_terminals_noah; k++)
{
sprintf( log, "vc-occupancy/terminals/slimfly_terminal_occupancy_log.%d.txt", k );
slimfly_terminal_occupancy_log=fopen(log, "w+");
if(slimfly_terminal_occupancy_log == NULL)
{
printf("Failed to open slimfly terminal occupancy log file vc-occupancy/terminals/slimfly_terminal_occupancy_log.%d.txt\n",k);
tw_error(TW_LOC, "\n Failed to open slimfly terminal occupancy log file \n");
}
for( i=0; i<N_COLLECT_POINTS; i++ )
{
if(i == 0)
{
fprintf(slimfly_terminal_occupancy_log, "%d, ",i*100/N_COLLECT_POINTS);
}
else
{
fprintf(slimfly_terminal_occupancy_log, "\n%d, ",i*100/N_COLLECT_POINTS);
}
for( j=0; j<1; j++)
{
fprintf(slimfly_terminal_occupancy_log, "%d, ", vc_occupancy_storage_terminal[k][j][i]);
}
}
}
}
fclose(slimfly_terminal_occupancy_log);
if(tw_ismaster())
{
printf("Printing Realtime Terminal Occupancy Log Files\n");
for(k=0; k<slim_total_terminals_noah; k++)
{
sprintf( log, "vc-occupancy/terminals/slimfly_terminal_occupancy_log.%d.txt", k );
slimfly_terminal_occupancy_log=fopen(log, "w+");
if(slimfly_terminal_occupancy_log == NULL)
{
printf("Failed to open slimfly terminal occupancy log file vc-occupancy/terminals/slimfly_terminal_occupancy_log.%d.txt\n",k);
tw_error(TW_LOC, "\n Failed to open slimfly terminal occupancy log file \n");
}
for( i=0; i<N_COLLECT_POINTS; i++ )
{
if(i == 0)
{
fprintf(slimfly_terminal_occupancy_log, "%d, ",i*100/N_COLLECT_POINTS);
}
else
{
fprintf(slimfly_terminal_occupancy_log, "\n%d, ",i*100/N_COLLECT_POINTS);
}
for( j=0; j<1; j++)
{
fprintf(slimfly_terminal_occupancy_log, "%d, ", vc_occupancy_storage_terminal[k][j][i]);
}
}
}
}
fclose(slimfly_terminal_occupancy_log);
#endif