Commit a4ad277f authored by Caitlin Ross's avatar Caitlin Ross

fixing segfaults when using virtual time sampling

parent 7606e0ef
...@@ -1004,7 +1004,7 @@ void router_custom_setup(router_state * r, tw_lp * lp) ...@@ -1004,7 +1004,7 @@ void router_custom_setup(router_state * r, tw_lp * lp)
r->busy_time_ross_sample = (tw_stime*)calloc(p->radix, sizeof(tw_stime)); r->busy_time_ross_sample = (tw_stime*)calloc(p->radix, sizeof(tw_stime));
if (g_st_model_stats) if (g_st_model_stats)
lp->model_types->mstat_sz = sizeof(tw_lpid) + (sizeof(int64_t) + sizeof(tw_stime)) * p->radix; lp->model_types->mstat_sz = sizeof(tw_lpid) + (sizeof(int64_t) + sizeof(tw_stime)) * p->radix;
if (g_st_use_analysis_lps) if (g_st_use_analysis_lps && g_st_model_stats)
lp->model_types->sample_struct_sz = sizeof(struct dfly_router_sample) + (sizeof(tw_stime) + sizeof(int64_t)) * p->radix; lp->model_types->sample_struct_sz = sizeof(struct dfly_router_sample) + (sizeof(tw_stime) + sizeof(int64_t)) * p->radix;
r->ross_rsample.busy_time = (tw_stime*)calloc(p->radix, sizeof(tw_stime)); r->ross_rsample.busy_time = (tw_stime*)calloc(p->radix, sizeof(tw_stime));
r->ross_rsample.link_traffic_sample = (int64_t*)calloc(p->radix, sizeof(int64_t)); r->ross_rsample.link_traffic_sample = (int64_t*)calloc(p->radix, sizeof(int64_t));
......
...@@ -911,7 +911,7 @@ static void router_setup(router_state * r, tw_lp * lp) ...@@ -911,7 +911,7 @@ static void router_setup(router_state * r, tw_lp * lp)
r->busy_time_ross_sample = (tw_stime*)calloc(p->radix, sizeof(tw_stime)); r->busy_time_ross_sample = (tw_stime*)calloc(p->radix, sizeof(tw_stime));
if (g_st_model_stats) if (g_st_model_stats)
lp->model_types->mstat_sz = sizeof(tw_lpid) + (sizeof(int64_t) + sizeof(tw_stime)) * p->radix; lp->model_types->mstat_sz = sizeof(tw_lpid) + (sizeof(int64_t) + sizeof(tw_stime)) * p->radix;
if (g_st_use_analysis_lps) if (g_st_use_analysis_lps && g_st_model_stats)
lp->model_types->sample_struct_sz = sizeof(struct dfly_router_sample) + (sizeof(tw_stime) + sizeof(int64_t)) * p->radix; lp->model_types->sample_struct_sz = sizeof(struct dfly_router_sample) + (sizeof(tw_stime) + sizeof(int64_t)) * p->radix;
r->ross_rsample.busy_time = (tw_stime*)calloc(p->radix, sizeof(tw_stime)); r->ross_rsample.busy_time = (tw_stime*)calloc(p->radix, sizeof(tw_stime));
r->ross_rsample.link_traffic_sample = (int64_t*)calloc(p->radix, sizeof(int64_t)); r->ross_rsample.link_traffic_sample = (int64_t*)calloc(p->radix, sizeof(int64_t));
......
...@@ -1172,7 +1172,7 @@ void switch_init(switch_state * r, tw_lp * lp) ...@@ -1172,7 +1172,7 @@ void switch_init(switch_state * r, tw_lp * lp)
r->busy_time_sample = (tw_stime*)malloc(r->radix * sizeof(tw_stime)); r->busy_time_sample = (tw_stime*)malloc(r->radix * sizeof(tw_stime));
// ROSS Instrumentation // ROSS Instrumentation
if (g_st_use_analysis_lps) if (g_st_use_analysis_lps && g_st_model_stats)
lp->model_types->sample_struct_sz = sizeof(struct fattree_switch_sample) + sizeof(int) * r->radix; lp->model_types->sample_struct_sz = sizeof(struct fattree_switch_sample) + sizeof(int) * r->radix;
rc_stack_create(&r->st); rc_stack_create(&r->st);
......
...@@ -146,7 +146,8 @@ void mn_event_collect(model_net_wrap_msg *m, tw_lp *lp, char *buffer, int *colle ...@@ -146,7 +146,8 @@ void mn_event_collect(model_net_wrap_msg *m, tw_lp *lp, char *buffer, int *colle
sub_msg = ((char*)m)+msg_offsets[((model_net_base_state*)lp->cur_state)->net_id]; sub_msg = ((char*)m)+msg_offsets[((model_net_base_state*)lp->cur_state)->net_id];
if (((model_net_base_state*)lp->cur_state)->sub_model_type) if (((model_net_base_state*)lp->cur_state)->sub_model_type)
{ {
(((model_net_base_state*)lp->cur_state)->sub_model_type->ev_trace)(sub_msg, lp, buffer, collect_flag); if (g_st_ev_trace)
(((model_net_base_state*)lp->cur_state)->sub_model_type->ev_trace)(sub_msg, lp, buffer, collect_flag);
} }
break; break;
default: // this shouldn't happen, but can help detect an issue default: // this shouldn't happen, but can help detect an issue
......
...@@ -902,8 +902,8 @@ void slim_router_setup(router_state * r, tw_lp * lp) ...@@ -902,8 +902,8 @@ void slim_router_setup(router_state * r, tw_lp * lp)
r->busy_time = (tw_stime*)malloc(p->radix * sizeof(tw_stime)); r->busy_time = (tw_stime*)malloc(p->radix * sizeof(tw_stime));
// ROSS Instrumentation // ROSS Instrumentation
if (g_st_use_analysis_lps) if (g_st_use_analysis_lps && g_st_model_stats)
lp->model_types->sample_struct_sz = sizeof(struct slimfly_router_sample) + sizeof(int) * p->radix; lp->model_types->sample_struct_sz = sizeof(struct slimfly_router_sample) + sizeof(int) * p->radix;
rc_stack_create(&r->st); rc_stack_create(&r->st);
......
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