diff --git a/src/networks/model-net/fattree.c b/src/networks/model-net/fattree.c index b97606cc3f06e9276bdb8c781e783be5cf1cba14..14b95dc4499598b01c030b8e84af0c1957db86d4 100644 --- a/src/networks/model-net/fattree.c +++ b/src/networks/model-net/fattree.c @@ -296,6 +296,42 @@ struct switch_state int *lft; }; +/* ROSS Instrumentation Support */ +struct fattree_sample +{ + tw_lpid lpid; +}; + +void fattree_event_collect(fattree_message *m, tw_lp *lp, char *buffer, int *collect_flag); +void fattree_model_stat_collect(ft_terminal_state *s, tw_lp *lp, char *buffer); +static void ross_fattree_sample_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp, struct fattree_sample *sample); +static void ross_fattree_sample_rc_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp, struct fattree_sample *sample); +static void ross_fattree_ssample_fn(switch_state * s, tw_bf * bf, tw_lp * lp, struct fattree_sample *sample); +static void ross_fattree_ssample_rc_fn(switch_state * s, tw_bf * bf, tw_lp * lp, struct fattree_sample *sample); + +st_model_types fattree_model_types[] = { + {(rbev_trace_f) fattree_event_collect, + sizeof(int), + (ev_trace_f) fattree_event_collect, + sizeof(int), + (model_stat_f) fattree_model_stat_collect, + 0, // update when changing fattree_model_stat_collect + (sample_event_f) ross_fattree_sample_fn, + (sample_revent_f) ross_fattree_sample_rc_fn, + sizeof(struct fattree_sample) } , + {(rbev_trace_f) fattree_event_collect, + sizeof(int), + (ev_trace_f) fattree_event_collect, + sizeof(int), + (model_stat_f) fattree_model_stat_collect, + 0, // update when changing fattree_model_stat_collect + (sample_event_f) ross_fattree_ssample_fn, + (sample_revent_f) ross_fattree_ssample_rc_fn, + sizeof(struct fattree_sample) } , + {NULL, 0, NULL, 0, NULL, 0, NULL, NULL, 0} +}; +/* End of ROSS model stats collection */ + static tw_stime fattree_total_time = 0; static tw_stime fattree_max_latency = 0; //static tw_stime max_collective = 0; @@ -2967,7 +3003,23 @@ tw_lptype fattree_lps[] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0}, }; -/* For ROSS event tracing */ + +/* returns the fattree lp type for lp registration */ +static const tw_lptype* fattree_get_cn_lp_type(void) +{ + return(&fattree_lps[0]); +} +/*static const tw_lptype* fattree_get_switch_lp_type(void) +{ + return(&fattree_lps[1]); +} */ + +static void fattree_register(tw_lptype *base_type) { + lp_type_register(LP_CONFIG_NM, base_type); + lp_type_register("fattree_switch", &fattree_lps[1]); +} + +/* For ROSS Instrumentation */ void fattree_event_collect(fattree_message *m, tw_lp *lp, char *buffer, int *collect_flag) { (void)lp; @@ -2977,46 +3029,67 @@ void fattree_event_collect(fattree_message *m, tw_lp *lp, char *buffer, int *col memcpy(buffer, &type, sizeof(type)); } -// TODO will need to separate fattree_method into one for terminal and one for switch -// in order to use the ROSS model stats collection -st_model_types fattree_model_types[] = { - {(rbev_trace_f) fattree_event_collect, - sizeof(int), - (ev_trace_f) fattree_event_collect, - sizeof(int), - NULL, - 0}, - {NULL, 0, NULL, 0, NULL, 0} -}; +void fattree_model_stat_collect(ft_terminal_state *s, tw_lp *lp, char *buffer) +{ + (void)lp; + (void)s; + (void)buffer; -static const st_model_types *fattree_get_model_stat_types(void) + return; +} + +static void ross_fattree_sample_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp, struct fattree_sample *sample) { - return(&fattree_model_types[0]); + (void)lp; + (void)bf; + (void)s; + (void)sample; + + return; } -static void fattree_register_model_stats(st_model_types *base_type) +static void ross_fattree_sample_rc_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp, struct fattree_sample *sample) { - st_model_type_register(LP_CONFIG_NM, base_type); - st_model_type_register("fattree_switch", &fattree_model_types[0]); - //trace_type_register("fattree_switch", base_type); + (void)lp; + (void)bf; + (void)s; + (void)sample; + + return; } -/*** END of ROSS event tracing additions */ -/* returns the fattree lp type for lp registration */ -static const tw_lptype* fattree_get_cn_lp_type(void) +static void ross_fattree_ssample_fn(switch_state * s, tw_bf * bf, tw_lp * lp, struct fattree_sample *sample) { - return(&fattree_lps[0]); + (void)lp; + (void)bf; + (void)s; + (void)sample; + + return; } -/*static const tw_lptype* fattree_get_switch_lp_type(void) + +static void ross_fattree_ssample_rc_fn(switch_state * s, tw_bf * bf, tw_lp * lp, struct fattree_sample *sample) { - return(&fattree_lps[1]); -} */ + (void)lp; + (void)bf; + (void)s; + (void)sample; + + return; +} -static void fattree_register(tw_lptype *base_type) { - lp_type_register(LP_CONFIG_NM, base_type); - lp_type_register("fattree_switch", &fattree_lps[1]); +static const st_model_types *fattree_get_model_stat_types(void) +{ + return(&fattree_model_types[0]); } +static void fattree_register_model_stats(st_model_types *base_type) +{ + st_model_type_register(LP_CONFIG_NM, base_type); + st_model_type_register("fattree_switch", &fattree_model_types[1]); +} +/*** END of ROSS event tracing additions */ + struct model_net_method fattree_method = { .mn_configure = fattree_configure,