Commit 1dc14cdb authored by Caitlin Ross's avatar Caitlin Ross

cleaning up event tracing additions

parent 2c28436c
......@@ -21,8 +21,8 @@ const tw_lptype* lp_type_lookup(const char* name);
/* register an LP with CODES/ROSS */
void lp_type_register(const char* name, const tw_lptype* type);
void ev_type_register(const char* name, const st_event_collect* type);
const st_event_collect* evcol_type_lookup(const char* name);
void trace_type_register(const char* name, const st_trace_type* type);
const st_trace_type* trace_type_lookup(const char* name);
#ifdef __cplusplus
}
#endif
......
......@@ -63,8 +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)();
void (*mn_trace_register)(st_trace_type *base_type);
const st_trace_type* (*mn_get_trace_type)();
};
extern struct model_net_method * method_array[];
......
......@@ -106,42 +106,32 @@ tw_lptype svr_lp = {
sizeof(svr_state),
};
void rb_svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer)
/* setup for the ROSS event tracing
* 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 svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer)
{
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
if(type < 0 || type > 3)
{
tw_event *cev = (tw_event*)(m - 1);
char grp_name[64];
char src_lp_type_name[64];
char dest_lp_type_name[64];
char ann[64];
int grp_index, lp_type_idx, rid, offs;
codes_mapping_get_lp_info(cev->send_lp, grp_name, &grp_index, src_lp_type_name,
&lp_type_idx, ann, &rid, &offs);
codes_mapping_get_lp_info(lp->gid, grp_name, &grp_index, dest_lp_type_name,
&lp_type_idx, ann, &rid, &offs);
printf("src: %s, dest: %s, recv_ts= %f, evtype: %d\n", src_lp_type_name, dest_lp_type_name, tw_now(lp), m->svr_event_type);
}
}
st_event_collect svr_event_types[] = {
{(rbev_col_f) rb_svr_event_collect,
st_trace_type svr_trace_types[] = {
{(rbev_trace_f) svr_event_collect,
sizeof(int),
(ev_col_f) rb_svr_event_collect,
(ev_trace_f) svr_event_collect,
sizeof(int)},
{0}
};
static const st_event_collect *svr_get_event_type(void)
static const st_trace_type *svr_get_trace_types(void)
{
return(&svr_event_types[0]);
return(&svr_trace_types[0]);
}
void svr_register_evcol()
void svr_register_trace()
{
ev_type_register("server", svr_get_event_type());
trace_type_register("server", svr_get_trace_types());
}
const tw_optdef app_opt [] =
......@@ -403,12 +393,8 @@ int main(
model_net_register();
svr_add_lp_type();
if (g_st_ev_rb_collect || g_st_ev_collect)
{
//dragonfly_register_evcol();
//router_register_evcol();
svr_register_evcol();
}
if (g_st_ev_trace)
svr_register_trace();
codes_mapping_setup();
......
......@@ -3256,48 +3256,36 @@ tw_lptype dragonfly_lps[] =
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0},
};
void rb_event_collect(terminal_message *m, tw_lp *lp, char *buffer)
/* For ROSS event tracing */
void dragonfly_event_collect(terminal_message *m, tw_lp *lp, char *buffer)
{
int type = (int) m->type;
memcpy(buffer, &type, sizeof(type));
if(type < 0 || type > 10)
{
tw_event *cev = (tw_event*)(m - 1);
char grp_name[64];
char src_lp_type_name[64];
char dest_lp_type_name[64];
char ann[64];
int grp_index, lp_type_idx, rid, offs;
codes_mapping_get_lp_info(cev->send_lp, grp_name, &grp_index, src_lp_type_name,
&lp_type_idx, ann, &rid, &offs);
codes_mapping_get_lp_info(lp->gid, grp_name, &grp_index, dest_lp_type_name,
&lp_type_idx, ann, &rid, &offs);
printf("src: %s, dest: %s, recv_ts= %f, evtype: %d\n", src_lp_type_name, dest_lp_type_name, tw_now(lp), m->type);
}
}
st_event_collect event_types[] = {
{(rbev_col_f) rb_event_collect,
st_trace_type dragonfly_trace_types[] = {
{(rbev_trace_f) dragonfly_event_collect,
sizeof(int),
(ev_col_f) rb_event_collect,
(ev_trace_f) dragonfly_event_collect,
sizeof(int)},
{0}
};
static const st_event_collect *dragonfly_get_event_type(void)
static const st_trace_type *dragonfly_get_trace_types(void)
{
return(&event_types[0]);
return(&dragonfly_trace_types[0]);
}
void dragonfly_register_evcol(st_event_collect *base_type)
static void dragonfly_register_trace(st_trace_type *base_type)
{
ev_type_register(LP_CONFIG_NM_TERM, base_type);
trace_type_register(LP_CONFIG_NM_TERM, base_type);
}
void router_register_evcol(st_event_collect *base_type)
static void router_register_trace(st_trace_type *base_type)
{
ev_type_register(LP_CONFIG_NM_ROUT, base_type);
trace_type_register(LP_CONFIG_NM_ROUT, base_type);
}
/*** END of ROSS event tracing additions */
/* returns the dragonfly lp type for lp registration */
static const tw_lptype* dragonfly_get_cn_lp_type(void)
......@@ -3334,9 +3322,9 @@ struct model_net_method dragonfly_method =
.mn_sample_fn = (void*)dragonfly_sample_fn,
.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,
.mn_sample_fini_fn = (void*)dragonfly_sample_fin,
.mn_trace_register = dragonfly_register_trace,
.mn_get_trace_type = dragonfly_get_trace_types,
};
struct model_net_method dragonfly_router_method =
......@@ -3355,7 +3343,7 @@ struct model_net_method dragonfly_router_method =
.mn_sample_fn = (void*)dragonfly_rsample_fn,
.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,
.mn_sample_fini_fn = (void*)dragonfly_rsample_fin,
.mn_trace_register = router_register_trace,
.mn_get_trace_type = dragonfly_get_trace_types,
};
......@@ -113,16 +113,20 @@ tw_lptype model_net_base_lp = {
sizeof(model_net_base_state),
};
/* setup for the ROSS event tracing
* 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)
{
int type = (int) m->h.event_type;
memcpy(buffer, &type, sizeof(type));
}
st_event_collect mn_event_types = {
(rbev_col_f) mn_event_collect,
st_trace_type mn_trace_types = {
(rbev_trace_f) mn_event_collect,
sizeof(int),
(ev_col_f) mn_event_collect,
(ev_trace_f) mn_event_collect,
sizeof(int),
};
......@@ -164,12 +168,12 @@ 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 (g_st_ev_trace) // for ROSS event tracing
{
if (method_array[i]->mn_ev_register == NULL)
ev_type_register(model_net_lp_config_names[i], &mn_event_types);
if (method_array[i]->mn_trace_register == NULL)
trace_type_register(model_net_lp_config_names[i], &mn_trace_types);
else
method_array[i]->mn_ev_register(&mn_event_types);
method_array[i]->mn_trace_register(&mn_trace_types);
}
}
}
......
......@@ -458,7 +458,7 @@ static void codes_mapping_init(void)
tw_lpid nkp_per_pe = g_tw_nkp;
tw_lpid lpid, kpid;
const tw_lptype *lptype;
const st_event_collect *ev_type;
const st_trace_type *trace_type;
/* have 16 kps per pe, this is the optimized configuration for ROSS custom mapping */
for(kpid = 0; kpid < nkp_per_pe; kpid++)
......@@ -489,10 +489,10 @@ static void codes_mapping_init(void)
else
/* sorry, const... */
tw_lp_settype(ross_lid, (tw_lptype*) lptype);
if (g_st_ev_rb_collect || g_st_ev_collect)
if (g_st_ev_trace)
{
ev_type = evcol_type_lookup(lp_type_name);
st_evcol_settype(ross_lid, (st_event_collect*) ev_type);
trace_type = trace_type_lookup(lp_type_name);
st_evtrace_settype(ross_lid, (st_trace_type*) trace_type);
}
}
return;
......
......@@ -16,7 +16,7 @@ struct lp_name_mapping
{
const char* name;
const tw_lptype* type;
const st_event_collect* ev_type;
const st_trace_type* trace_type;
};
static struct lp_name_mapping map_array[MAX_LP_TYPES];
......@@ -48,7 +48,7 @@ const tw_lptype* lp_type_lookup(const char* name)
}
// needs to be called after lp_type_register()
void ev_type_register(const char* name, const st_event_collect* type)
void trace_type_register(const char* name, const st_trace_type* type)
{
int i;
......@@ -56,12 +56,12 @@ void ev_type_register(const char* name, const st_event_collect* type)
{
if(strcmp(name, map_array[i].name) == 0)
{
map_array[i].ev_type = type;
map_array[i].trace_type = type;
}
}
}
const st_event_collect* evcol_type_lookup(const char* name)
const st_trace_type* trace_type_lookup(const char* name)
{
int i;
......@@ -69,7 +69,7 @@ const st_event_collect* evcol_type_lookup(const char* name)
{
if(strcmp(name, map_array[i].name) == 0)
{
return(map_array[i].ev_type);
return(map_array[i].trace_type);
}
}
......
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