Commit befb2c49 authored by Caitlin Ross's avatar Caitlin Ross

adding support for event collection in ROSS

parent dd64e83f
......@@ -21,6 +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);
#ifdef __cplusplus
}
#endif
......
......@@ -13,6 +13,9 @@ extern "C" {
#include <ross.h>
void dragonfly_register_evcol();
void router_register_evcol();
typedef struct terminal_message terminal_message;
/* this message is used for both dragonfly compute nodes and routers */
......
......@@ -105,6 +105,30 @@ tw_lptype svr_lp = {
sizeof(svr_state),
};
void rb_svr_event_collect(svr_msg *m, char *buffer)
{
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
st_event_collect svr_event_types[] = {
{(rbev_col_f) rb_svr_event_collect,
sizeof(int),
(ev_col_f) NULL,
0},
{0}
};
static const st_event_collect *svr_get_event_type(void)
{
return(&svr_event_types[0]);
}
void svr_register_evcol()
{
ev_type_register("server", svr_get_event_type());
}
const tw_optdef app_opt [] =
{
TWOPT_GROUP("Model net synthetic traffic " ),
......@@ -364,6 +388,13 @@ int main(
model_net_register();
svr_add_lp_type();
if (g_st_ev_rb_collect)
{
dragonfly_register_evcol();
router_register_evcol();
svr_register_evcol();
}
codes_mapping_setup();
net_ids = model_net_configure(&num_nets);
......
......@@ -3256,6 +3256,35 @@ tw_lptype dragonfly_lps[] =
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0},
};
void rb_event_collect(terminal_message *m, char *buffer)
{
int type = (int) m->type;
memcpy(buffer, &type, sizeof(type));
}
st_event_collect event_types[] = {
{(rbev_col_f) rb_event_collect,
sizeof(int),
(ev_col_f) NULL,
0},
{0}
};
static const st_event_collect *dragonfly_get_event_type(void)
{
return(&event_types[0]);
}
void dragonfly_register_evcol()
{
ev_type_register(LP_CONFIG_NM_TERM, dragonfly_get_event_type());
}
void router_register_evcol()
{
ev_type_register(LP_CONFIG_NM_ROUT, dragonfly_get_event_type());
}
/* returns the dragonfly lp type for lp registration */
static const tw_lptype* dragonfly_get_cn_lp_type(void)
{
......
......@@ -458,6 +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;
/* have 16 kps per pe, this is the optimized configuration for ROSS custom mapping */
for(kpid = 0; kpid < nkp_per_pe; kpid++)
......@@ -488,6 +489,11 @@ static void codes_mapping_init(void)
else
/* sorry, const... */
tw_lp_settype(ross_lid, (tw_lptype*) lptype);
if (g_st_ev_rb_collect)
{
ev_type = evcol_type_lookup(lp_type_name);
st_evcol_settype(ross_lid, (st_event_collect*) ev_type);
}
}
return;
}
......
......@@ -16,6 +16,7 @@ struct lp_name_mapping
{
const char* name;
const tw_lptype* type;
const st_event_collect* ev_type;
};
static struct lp_name_mapping map_array[MAX_LP_TYPES];
......@@ -46,6 +47,35 @@ const tw_lptype* lp_type_lookup(const char* name)
return(NULL);
}
// needs to be called after lp_type_register()
void ev_type_register(const char* name, const st_event_collect* type)
{
int i;
for(i=0; i<map_array_size; i++)
{
if(strcmp(name, map_array[i].name) == 0)
{
map_array[i].ev_type = type;
}
}
}
const st_event_collect* evcol_type_lookup(const char* name)
{
int i;
for(i=0; i<map_array_size; i++)
{
if(strcmp(name, map_array[i].name) == 0)
{
return(map_array[i].ev_type);
}
}
return(NULL);
}
/*
* Local variables:
* c-indent-level: 4
......
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