Commit eacc20a4 authored by Caitlin Ross's avatar Caitlin Ross

fixed issues with event tracing in model-net layer

parent 2e4e0f3e
......@@ -388,6 +388,7 @@ void model_net_set_msg_param(
/* returns pointer to LP information for simplenet module */
const tw_lptype* model_net_get_lp_type(int net_id);
const st_trace_type* model_net_get_trace_type(int net_id);
DEPRECATED
uint64_t model_net_get_packet_size(int net_id);
......
......@@ -124,7 +124,7 @@ tw_lptype svr_lp = {
* can have a different function for rbev_trace_f and ev_trace_f
* but right now it is set to the same function for both
*/
void ft_svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer)
void ft_svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
......
......@@ -2962,7 +2962,7 @@ tw_lptype fattree_lps[] =
};
/* For ROSS event tracing */
void fattree_event_collect(fattree_message *m, tw_lp *lp, char *buffer)
void fattree_event_collect(fattree_message *m, tw_lp *lp, char *buffer, int *collect_flag)
{
int type = (int) m->type;
memcpy(buffer, &type, sizeof(type));
......@@ -2984,7 +2984,8 @@ static const st_trace_type *fattree_get_trace_types(void)
static void fattree_register_trace(st_trace_type *base_type)
{
trace_type_register(LP_CONFIG_NM, base_type);
trace_type_register("fattree_switch", base_type);
trace_type_register("fattree_switch", &fattree_trace_types[0]);
//trace_type_register("fattree_switch", base_type);
}
/*** END of ROSS event tracing additions */
......
......@@ -53,6 +53,7 @@ typedef struct model_net_base_state {
// lp type and state of underlying model net method - cache here so we
// don't have to constantly look up
const tw_lptype *sub_type;
const st_trace_type *sub_trace_type;
void *sub_state;
} model_net_base_state;
......@@ -117,29 +118,36 @@ tw_lptype model_net_base_lp = {
* can have a different function for rbev_trace_f and ev_trace_f
* but right now it is set to the same function for both
*/
void mn_event_collect(model_net_wrap_msg *m, tw_lp *lp, char *buffer)
void mn_event_collect(model_net_wrap_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
// assigning large numbers to message types to make it easier to
// determine which messages are model net base LP msgs
int type;
void * sub_msg;
switch (m->h.event_type){
case MN_BASE_NEW_MSG:
type = 9000;
memcpy(buffer, &type, sizeof(type));
break;
case MN_BASE_SCHED_NEXT:
type = 9001;
memcpy(buffer, &type, sizeof(type));
break;
case MN_BASE_SAMPLE:
type = 9002;
memcpy(buffer, &type, sizeof(type));
break;
case MN_BASE_PASS:
type = 9003;
sub_msg = ((char*)m)+msg_offsets[((model_net_base_state*)lp->cur_state)->net_id];
if (g_st_ev_trace == RB_TRACE)
(((model_net_base_state*)lp->cur_state)->sub_trace_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_trace_type->ev_trace)(sub_msg, lp, buffer, collect_flag);
break;
default:
default: // this shouldn't happen, but can help detect an issue
type = 9004;
break;
}
memcpy(buffer, &type, sizeof(type));
}
st_trace_type mn_trace_types = {
......@@ -395,6 +403,10 @@ void model_net_base_lp_init(
ns->sched_recv);
ns->sub_type = model_net_get_lp_type(ns->net_id);
if (g_st_ev_trace)
ns->sub_trace_type = model_net_get_trace_type(ns->net_id);
// NOTE: some models actually expect LP state to be 0 initialized...
// *cough anything that uses mn_stats_array cough*
ns->sub_state = calloc(1, ns->sub_type->state_sz);
......
......@@ -597,6 +597,11 @@ const tw_lptype* model_net_get_lp_type(int net_id)
return method_array[net_id]->mn_get_lp_type();
}
const st_trace_type* model_net_get_trace_type(int net_id)
{
return method_array[net_id]->mn_get_trace_type();
}
void model_net_report_stats(int net_id)
{
if(net_id < 0 || net_id >= MAX_NETS)
......
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