Commit a4d43ae4 authored by Caitlin Ross's avatar Caitlin Ross

added event tracing support to model net base lp

parent 63751b09
......@@ -63,6 +63,8 @@ struct model_net_method
revent_f mn_sample_rc_fn;
init_f mn_sample_init_fn;
final_f mn_sample_fini_fn;
void (*mn_ev_register)(st_event_collect *base_type);
const st_event_collect* (*mn_get_event_type)();
};
extern struct model_net_method * method_array[];
......
......@@ -405,8 +405,8 @@ int main(
if (g_st_ev_rb_collect || g_st_ev_collect)
{
dragonfly_register_evcol();
router_register_evcol();
//dragonfly_register_evcol();
//router_register_evcol();
svr_register_evcol();
}
......
......@@ -3289,14 +3289,14 @@ static const st_event_collect *dragonfly_get_event_type(void)
return(&event_types[0]);
}
void dragonfly_register_evcol()
void dragonfly_register_evcol(st_event_collect *base_type)
{
ev_type_register(LP_CONFIG_NM_TERM, dragonfly_get_event_type());
ev_type_register(LP_CONFIG_NM_TERM, base_type);
}
void router_register_evcol()
void router_register_evcol(st_event_collect *base_type)
{
ev_type_register(LP_CONFIG_NM_ROUT, dragonfly_get_event_type());
ev_type_register(LP_CONFIG_NM_ROUT, base_type);
}
/* returns the dragonfly lp type for lp registration */
......@@ -3335,6 +3335,8 @@ struct model_net_method dragonfly_method =
.mn_sample_rc_fn = (void*)dragonfly_sample_rc_fn,
.mn_sample_init_fn = (void*)dragonfly_sample_init,
.mn_sample_fini_fn = (void*)dragonfly_sample_fin
.mn_ev_register = dragonfly_register_evcol,
.mn_get_event_type = dragonfly_get_event_type,
};
struct model_net_method dragonfly_router_method =
......@@ -3354,4 +3356,6 @@ struct model_net_method dragonfly_router_method =
.mn_sample_rc_fn = (void*)dragonfly_rsample_rc_fn,
.mn_sample_init_fn = (void*)dragonfly_rsample_init,
.mn_sample_fini_fn = (void*)dragonfly_rsample_fin
.mn_ev_register = router_register_evcol,
.mn_get_event_type = dragonfly_get_event_type,
};
......@@ -113,6 +113,19 @@ tw_lptype model_net_base_lp = {
sizeof(model_net_base_state),
};
void mn_event_collect(model_net_wrap_msg *m, tw_lp *lp, char *buffer)
{
int type = (int) m->h.event_type;
memcpy(buffer, &type, sizeof(type));
}
st_event_collect mn_event_types = {
(rbev_col_f) mn_event_collect,
sizeof(int),
(ev_col_f) mn_event_collect,
sizeof(int),
};
/**** END LP, EVENT PROCESSING FUNCTION DECLS ****/
/**** BEGIN IMPLEMENTATIONS ****/
......@@ -151,6 +164,13 @@ void model_net_base_register(int *do_config_nets){
&model_net_base_lp);
else
method_array[i]->mn_register(&model_net_base_lp);
if (g_st_ev_rb_collect || g_st_ev_collect)
{
if (method_array[i]->mn_ev_register == NULL)
ev_type_register(model_net_lp_config_names[i], &mn_event_types);
else
method_array[i]->mn_ev_register(&mn_event_types);
}
}
}
}
......
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