Commit 3435735f authored by Misbah Mubarak's avatar Misbah Mubarak

Fixing memory allocation with wait-time

parent c5642c7f
......@@ -871,7 +871,7 @@ terminal_custom_init( terminal_state * s,
rc_stack_create(&s->st);
s->num_vcs = 1;
s->vc_occupancy = (int*)malloc(s->num_vcs * sizeof(int));
s->last_buf_full = (tw_stime*)malloc(s->num_vcs * sizeof(int));
s->last_buf_full = (tw_stime*)malloc(s->num_vcs * sizeof(tw_stime));
for( i = 0; i < s->num_vcs; i++ )
{
......
......@@ -790,15 +790,15 @@ terminal_init( terminal_state * s,
s->finished_packets = 0;
s->total_time = 0.0;
s->total_msg_size = 0;
s->num_vcs = 1;
s->last_buf_full = (tw_stime*)malloc(s->num_vcs * sizeof(int));
s->last_buf_full = (tw_stime*)malloc(s->num_vcs * sizeof(tw_stime));
s->busy_time = 0.0;
s->fwd_events = 0;
s->rev_events = 0;
rc_stack_create(&s->st);
s->num_vcs = 1;
s->vc_occupancy = (int*)malloc(s->num_vcs * sizeof(int));
for( i = 0; i < s->num_vcs; i++ )
......
......@@ -784,11 +784,11 @@ void slim_terminal_init( terminal_state * s,
s->total_time = 0.0;
s->total_msg_size = 0;
s->last_buf_full = (tw_stime*)malloc(s->num_vcs * sizeof(int));
s->busy_time = 0;
rc_stack_create(&s->st);
s->num_vcs = 1;
s->last_buf_full = (tw_stime*)malloc(s->num_vcs * sizeof(tw_stime));
s->vc_occupancy = (int*)malloc(s->num_vcs * sizeof(int));
for( i = 0; i < s->num_vcs; i++ )
......
......@@ -1297,7 +1297,7 @@ static void packet_send( nodes_state * s,
if(cur_entry == NULL)
{
bf->c4 = 1;
if(!s->last_buf_full[queue])
if(s->queued_msgs[queue][STATICQ] != NULL && s->last_buf_full[queue] == 0.0)
{
bf->c24 = 1;
msg->saved_busy_time = s->last_buf_full[queue];
......
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