Commit 075727c7 authored by Caitlin Ross's avatar Caitlin Ross

fixing bug in virtual time sampling for models that don't need it

parent 92ea64e4
......@@ -146,10 +146,13 @@ void mn_event_collect(model_net_wrap_msg *m, tw_lp *lp, char *buffer, int *colle
break;
case MN_BASE_PASS:
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 (g_st_ev_trace == RB_TRACE || g_st_ev_trace == COMMIT_TRACE)
(((model_net_base_state*)lp->cur_state)->sub_model_type->rbev_trace)(sub_msg, lp, buffer, collect_flag);
else if (g_st_ev_trace == FULL_TRACE)
(((model_net_base_state*)lp->cur_state)->sub_model_type->ev_trace)(sub_msg, lp, buffer, collect_flag);
}
break;
default: // this shouldn't happen, but can help detect an issue
type = 9004;
......@@ -160,17 +163,20 @@ void mn_event_collect(model_net_wrap_msg *m, tw_lp *lp, char *buffer, int *colle
void mn_model_stat_collect(model_net_base_state *s, tw_lp *lp, char *buffer)
{
// need to call the model level stats collection fn
if (s->sub_model_type)
(*s->sub_model_type->model_stat_fn)(s->sub_state, lp, buffer);
return;
}
void mn_sample_event(model_net_base_state *s, tw_bf * bf, tw_lp * lp, void *sample)
{
if (s->sub_model_type)
(*s->sub_model_type->sample_event_fn)(s->sub_state, bf, lp, sample);
}
void mn_sample_rc_event(model_net_base_state *s, tw_bf * bf, tw_lp * lp, void *sample)
{
if (s->sub_model_type)
(*s->sub_model_type->sample_revent_fn)(s->sub_state, bf, lp, sample);
}
......@@ -227,16 +233,17 @@ void model_net_base_register(int *do_config_nets){
else
method_array[i]->mn_register(&model_net_base_lp);
if (g_st_ev_trace || g_st_model_stats || g_st_use_analysis_lps) // for ROSS event tracing
{
if (method_array[i]->mn_model_stat_register != NULL)
// st_model_type_register(model_net_lp_config_names[i], &mn_model_types[i]);
//else
{
memcpy(&mn_model_types[i], &mn_model_base_type, sizeof(st_model_types));
if (method_array[i]->mn_model_stat_register == NULL)
st_model_type_register(model_net_lp_config_names[i], &mn_model_types[i]);
else
method_array[i]->mn_model_stat_register(&mn_model_types[i]);
}
}
}
}
}
static void base_read_config(const char * anno, model_net_base_params *p){
......@@ -481,9 +488,12 @@ void model_net_base_lp_init(
if (g_st_ev_trace || g_st_model_stats || g_st_use_analysis_lps)
{
ns->sub_model_type = model_net_get_model_stat_type(ns->net_id);
if (ns->sub_model_type)
{
mn_model_types[ns->net_id].mstat_sz = ns->sub_model_type->mstat_sz;
mn_model_types[ns->net_id].sample_struct_sz = ns->sub_model_type->sample_struct_sz;
}
}
// NOTE: some models actually expect LP state to be 0 initialized...
// *cough anything that uses mn_stats_array cough*
......
......@@ -629,7 +629,10 @@ const tw_lptype* model_net_get_lp_type(int net_id)
const st_model_types* model_net_get_model_stat_type(int net_id)
{
if (method_array[net_id]->mn_get_model_stat_types)
return method_array[net_id]->mn_get_model_stat_types();
else
return NULL;
}
void model_net_report_stats(int net_id)
......
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