Commit befb2c49 authored by Caitlin Ross's avatar Caitlin Ross
Browse files

adding support for event collection in ROSS

parent dd64e83f
...@@ -21,6 +21,8 @@ const tw_lptype* lp_type_lookup(const char* name); ...@@ -21,6 +21,8 @@ const tw_lptype* lp_type_lookup(const char* name);
/* register an LP with CODES/ROSS */ /* register an LP with CODES/ROSS */
void lp_type_register(const char* name, const tw_lptype* type); 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 #ifdef __cplusplus
} }
#endif #endif
......
...@@ -13,6 +13,9 @@ extern "C" { ...@@ -13,6 +13,9 @@ extern "C" {
#include <ross.h> #include <ross.h>
void dragonfly_register_evcol();
void router_register_evcol();
typedef struct terminal_message terminal_message; typedef struct terminal_message terminal_message;
/* this message is used for both dragonfly compute nodes and routers */ /* this message is used for both dragonfly compute nodes and routers */
......
...@@ -105,6 +105,30 @@ tw_lptype svr_lp = { ...@@ -105,6 +105,30 @@ tw_lptype svr_lp = {
sizeof(svr_state), 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 [] = const tw_optdef app_opt [] =
{ {
TWOPT_GROUP("Model net synthetic traffic " ), TWOPT_GROUP("Model net synthetic traffic " ),
...@@ -364,6 +388,13 @@ int main( ...@@ -364,6 +388,13 @@ int main(
model_net_register(); model_net_register();
svr_add_lp_type(); svr_add_lp_type();
if (g_st_ev_rb_collect)
{
dragonfly_register_evcol();
router_register_evcol();
svr_register_evcol();
}
codes_mapping_setup(); codes_mapping_setup();
net_ids = model_net_configure(&num_nets); net_ids = model_net_configure(&num_nets);
......
...@@ -3256,6 +3256,35 @@ tw_lptype dragonfly_lps[] = ...@@ -3256,6 +3256,35 @@ tw_lptype dragonfly_lps[] =
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0}, {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 */ /* returns the dragonfly lp type for lp registration */
static const tw_lptype* dragonfly_get_cn_lp_type(void) static const tw_lptype* dragonfly_get_cn_lp_type(void)
{ {
......
...@@ -458,6 +458,7 @@ static void codes_mapping_init(void) ...@@ -458,6 +458,7 @@ static void codes_mapping_init(void)
tw_lpid nkp_per_pe = g_tw_nkp; tw_lpid nkp_per_pe = g_tw_nkp;
tw_lpid lpid, kpid; tw_lpid lpid, kpid;
const tw_lptype *lptype; const tw_lptype *lptype;
const st_event_collect *ev_type;
/* have 16 kps per pe, this is the optimized configuration for ROSS custom mapping */ /* have 16 kps per pe, this is the optimized configuration for ROSS custom mapping */
for(kpid = 0; kpid < nkp_per_pe; kpid++) for(kpid = 0; kpid < nkp_per_pe; kpid++)
...@@ -488,6 +489,11 @@ static void codes_mapping_init(void) ...@@ -488,6 +489,11 @@ static void codes_mapping_init(void)
else else
/* sorry, const... */ /* sorry, const... */
tw_lp_settype(ross_lid, (tw_lptype*) lptype); 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; return;
} }
......
...@@ -16,6 +16,7 @@ struct lp_name_mapping ...@@ -16,6 +16,7 @@ struct lp_name_mapping
{ {
const char* name; const char* name;
const tw_lptype* type; const tw_lptype* type;
const st_event_collect* ev_type;
}; };
static struct lp_name_mapping map_array[MAX_LP_TYPES]; static struct lp_name_mapping map_array[MAX_LP_TYPES];
...@@ -46,6 +47,35 @@ const tw_lptype* lp_type_lookup(const char* name) ...@@ -46,6 +47,35 @@ const tw_lptype* lp_type_lookup(const char* name)
return(NULL); 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: * Local variables:
* c-indent-level: 4 * 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