Commit 40598e19 authored by Caitlin Ross's avatar Caitlin Ross

updating/cleaning up ROSS instrumentation support in models

parent db898efc
......@@ -2652,9 +2652,41 @@ static void nw_add_lp_type()
lp_type_register("nw-lp", nw_get_lp_type());
}
/* setup for the ROSS event tracing
*/
void nw_lp_event_collect(nw_message *m, tw_lp *lp, char *buffer, int *collect_flag)
/***** ROSS model instrumentation *****/
void nw_lp_vt_sample_fn(nw_state *s, tw_bf *bf, tw_lp *lp);
void nw_lp_vt_sample_rc_fn(nw_state *s, tw_bf *bf, tw_lp *lp);
void nw_lp_rt_sample_fn(nw_state *s, tw_lp *lp);
void nw_lp_event_trace(nw_message *m, tw_lp *lp, char *buffer, int *collect_flag);
char nw_lp_name[] = "nw_server\0";
st_model_types nw_lp_model_types[] = {
{nw_lp_name,
NULL,
0,
(vts_event_f) nw_lp_vt_sample_fn,
(vts_revent_f) nw_lp_vt_sample_rc_fn,
(rt_event_f) nw_lp_rt_sample_fn,
(ev_trace_f) nw_lp_event_trace,
sizeof(int)},
{0}
};
void nw_lp_vt_sample_fn(nw_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
}
void nw_lp_vt_sample_rc_fn(nw_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
}
void nw_lp_event_trace(nw_message *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)collect_flag;
......@@ -2663,30 +2695,12 @@ void nw_lp_event_collect(nw_message *m, tw_lp *lp, char *buffer, int *collect_fl
memcpy(buffer, &type, sizeof(type));
}
/* can add in any model level data to be collected along with simulation engine data
* in the ROSS instrumentation. Will need to update the last field in
* nw_lp_model_types[0] for the size of the data to save in each function call
*/
void nw_lp_model_stat_collect(nw_state *s, tw_lp *lp, char *buffer)
void nw_lp_rt_sample_fn(nw_state *s, tw_lp *lp)
{
(void)s;
(void)lp;
(void)buffer;
return;
}
st_model_types nw_lp_model_types[] = {
{(ev_trace_f) nw_lp_event_collect,
sizeof(int),
(model_stat_f) nw_lp_model_stat_collect,
0,
NULL,
NULL,
0},
{NULL, 0, NULL, 0, NULL, NULL, 0}
};
static const st_model_types *nw_lp_get_model_stat_types(void)
{
return(&nw_lp_model_types[0]);
......@@ -2696,7 +2710,7 @@ void nw_lp_register_model()
{
st_model_type_register("nw-lp", nw_lp_get_model_stat_types());
}
/* end of ROSS event tracing setup */
/***** End of ROSS Instrumentation *****/
static int msg_size_hash_compare(
void *key, struct qhash_head *link)
......
......@@ -111,38 +111,53 @@ tw_lptype svr_lp = {
sizeof(svr_state),
};
/* setup for the ROSS event tracing
*/
void custom_svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
/***** ROSS model instrumentation *****/
void custom_svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void custom_svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void custom_svr_rt_sample_fn(svr_state *s, tw_lp *lp);
void custom_svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag);
char custom_svr_name[] = "dfly_custom_server\0";
st_model_types custom_svr_model_types[] = {
{custom_svr_name,
NULL,
0,
(vts_event_f) custom_svr_vt_sample_fn,
(vts_revent_f) custom_svr_vt_sample_rc_fn,
(rt_event_f) custom_svr_rt_sample_fn,
(ev_trace_f) custom_svr_event_trace,
sizeof(int)},
{0}
};
void custom_svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
/* can add in any model level data to be collected along with simulation engine data
* in the ROSS instrumentation. Will need to update the last field in
* svr_model_types[0] for the size of the data to save in each function call
*/
void custom_svr_model_stat_collect(svr_state *s, tw_lp *lp, char *buffer)
void custom_svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
(void)buffer;
return;
}
st_model_types custom_svr_model_types[] = {
{(ev_trace_f) custom_svr_event_collect,
sizeof(int),
(model_stat_f) custom_svr_model_stat_collect,
0,
NULL,
NULL,
0},
{NULL, 0, NULL, 0, NULL, NULL, 0}
};
void custom_svr_rt_sample_fn(svr_state *s, tw_lp *lp)
{
(void)s;
(void)lp;
}
void custom_svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
static const st_model_types *custom_svr_get_model_stat_types(void)
{
......@@ -154,6 +169,8 @@ void custom_svr_register_model_types()
st_model_type_register("nw-lp", custom_svr_get_model_stat_types());
}
/***** End of ROSS Instrumentation *****/
const tw_optdef app_opt [] =
{
TWOPT_GROUP("Model net synthetic traffic " ),
......
......@@ -110,6 +110,65 @@ tw_lptype svr_lp = {
sizeof(svr_state),
};
/***** ROSS model instrumentation *****/
void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_rt_sample_fn(svr_state *s, tw_lp *lp);
void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag);
char svr_name[] = "dfly_plus_server\0";
st_model_types svr_model_types[] = {
{svr_name,
NULL,
0,
(vts_event_f) svr_vt_sample_fn,
(vts_revent_f) svr_vt_sample_rc_fn,
(rt_event_f) svr_rt_sample_fn,
(ev_trace_f) svr_event_trace,
sizeof(int)},
{0}
};
void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
}
void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
}
void svr_rt_sample_fn(svr_state *s, tw_lp *lp)
{
(void)s;
(void)lp;
}
void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
static const st_model_types *svr_get_model_stat_types(void)
{
return(&svr_model_types[0]);
}
void svr_register_model_types()
{
st_model_type_register("server", svr_get_model_stat_types());
}
/***** End of ROSS Instrumentation *****/
const tw_optdef app_opt [] =
{
TWOPT_GROUP("Model net synthetic traffic " ),
......@@ -437,6 +496,9 @@ int main(
model_net_register();
svr_add_lp_type();
if (g_st_ev_trace || g_st_model_stats || g_st_use_analysis_lps)
svr_register_model_types();
codes_mapping_setup();
net_ids = model_net_configure(&num_nets);
......
......@@ -122,42 +122,56 @@ tw_lptype svr_lp = {
sizeof(svr_state),
};
/* setup for the ROSS event tracing
*/
void ft_svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
/***** ROSS model instrumentation *****/
void ft_svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void ft_svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void ft_svr_rt_sample_fn(svr_state *s, tw_lp *lp);
void ft_svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag);
char ft_svr_name[] = "ft_server\0";
st_model_types ft_svr_model_types[] = {
{ft_svr_name,
NULL,
0,
(vts_event_f) ft_svr_vt_sample_fn,
(vts_revent_f) ft_svr_vt_sample_rc_fn,
(rt_event_f) ft_svr_rt_sample_fn,
(ev_trace_f) ft_svr_event_trace,
sizeof(int)},
{0}
};
void ft_svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
(void)buffer;
(void)collect_flag;
}
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
void ft_svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
}
/* can add in any model level data to be collected along with simulation engine data
* in the ROSS instrumentation. Will need to update the last field in
* ft_svr_model_types[0] for the size of the data to save in each function call
*/
void ft_svr_model_stat_collect(svr_state *s, tw_lp *lp, char *buffer)
void ft_svr_rt_sample_fn(svr_state *s, tw_lp *lp)
{
(void)s;
(void)lp;
}
void ft_svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)buffer;
(void)collect_flag;
return;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
st_model_types ft_svr_model_types[] = {
{(ev_trace_f) ft_svr_event_collect,
sizeof(int),
(model_stat_f) ft_svr_model_stat_collect,
0,
NULL,
NULL,
0},
{NULL, 0, NULL, 0, NULL, NULL, 0}
};
static const st_model_types *ft_svr_get_model_stat_types(void)
{
return(&ft_svr_model_types[0]);
......@@ -168,6 +182,8 @@ void ft_svr_register_model_stats()
st_model_type_register("server", ft_svr_get_model_stat_types());
}
/***** End of ROSS Instrumentation *****/
const tw_optdef app_opt [] =
{
TWOPT_GROUP("Model net synthetic traffic " ),
......
......@@ -120,38 +120,53 @@ tw_lptype svr_lp = {
sizeof(svr_state),
};
/* setup for the ROSS event tracing
*/
void svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
/***** ROSS model instrumentation *****/
void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_rt_sample_fn(svr_state *s, tw_lp *lp);
void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag);
char svr_name[] = "sfly_server\0";
st_model_types svr_model_types[] = {
{svr_name,
NULL,
0,
(vts_event_f) svr_vt_sample_fn,
(vts_revent_f) svr_vt_sample_rc_fn,
(rt_event_f) svr_rt_sample_fn,
(ev_trace_f) svr_event_trace,
sizeof(int)},
{0}
};
void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
/* can add in any model level data to be collected along with simulation engine data
* in the ROSS instrumentation. Will need to update the last field in
* svr_model_types[0] for the size of the data to save in each function call
*/
void svr_model_stat_collect(svr_state *s, tw_lp *lp, char *buffer)
void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
(void)buffer;
return;
}
st_model_types svr_model_types[] = {
{(ev_trace_f) svr_event_collect,
sizeof(int),
(model_stat_f) svr_model_stat_collect,
0,
NULL,
NULL,
0},
{NULL, 0, NULL, 0, NULL, NULL, 0}
};
void svr_rt_sample_fn(svr_state *s, tw_lp *lp)
{
(void)s;
(void)lp;
}
void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
static const st_model_types *svr_get_model_stat_types(void)
{
......@@ -163,6 +178,8 @@ void svr_register_model_types()
st_model_type_register("server", svr_get_model_stat_types());
}
/***** End of ROSS Instrumentation *****/
const tw_optdef app_opt [] =
{
TWOPT_GROUP("Model net synthetic traffic " ),
......
......@@ -107,38 +107,53 @@ tw_lptype svr_lp = {
sizeof(svr_state),
};
/* setup for the ROSS event tracing
*/
void svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
/***** ROSS model instrumentation *****/
void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp);
void svr_rt_sample_fn(svr_state *s, tw_lp *lp);
void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag);
char svr_name[] = "dfly_server\0";
st_model_types svr_model_types[] = {
{svr_name,
NULL,
0,
(vts_event_f) svr_vt_sample_fn,
(vts_revent_f) svr_vt_sample_rc_fn,
(rt_event_f) svr_rt_sample_fn,
(ev_trace_f) svr_event_trace,
sizeof(int)},
{0}
};
void svr_vt_sample_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
/* can add in any model level data to be collected along with simulation engine data
* in the ROSS instrumentation. Will need to update the last field in
* svr_model_types[0] for the size of the data to save in each function call
*/
void svr_model_stat_collect(svr_state *s, tw_lp *lp, char *buffer)
void svr_vt_sample_rc_fn(svr_state *s, tw_bf *bf, tw_lp *lp)
{
(void)s;
(void)bf;
(void)lp;
(void)buffer;
return;
}
st_model_types svr_model_types[] = {
{(ev_trace_f) svr_event_collect,
sizeof(int),
(model_stat_f) svr_model_stat_collect,
0,
NULL,
NULL,
0},
{NULL, 0, NULL, 0, NULL, NULL, 0}
};
void svr_rt_sample_fn(svr_state *s, tw_lp *lp)
{
(void)s;
(void)lp;
}
void svr_event_trace(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
(void)lp;
(void)collect_flag;
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
static const st_model_types *svr_get_model_stat_types(void)
{
......@@ -150,6 +165,8 @@ void svr_register_model_types()
st_model_type_register("server", svr_get_model_stat_types());
}
/***** End of ROSS Instrumentation *****/
const tw_optdef app_opt [] =
{
TWOPT_GROUP("Model net synthetic traffic " ),
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -296,12 +296,12 @@ struct switch_state
int *lft;
};
/* ROSS Instrumentation Support */
/***** ROSS model instrumentation *****/
struct fattree_cn_sample
{
tw_lpid terminal_id;
tw_stime end_time;
int vc_occupancy;
int vc_occupancy;
};
struct fattree_switch_sample
......@@ -311,31 +311,162 @@ struct fattree_switch_sample
tw_stime end_time;
};
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_cn_sample *sample);
static void ross_fattree_sample_rc_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp, struct fattree_cn_sample *sample);
static void ross_fattree_ssample_fn(switch_state * s, tw_bf * bf, tw_lp * lp, struct fattree_switch_sample *sample);
static void ross_fattree_ssample_rc_fn(switch_state * s, tw_bf * bf, tw_lp * lp, struct fattree_switch_sample *sample);
void fattree_event_trace(fattree_message *m, tw_lp *lp, char *buffer, int *collect_flag);
void fattree_rt_sample_fn(ft_terminal_state *s, tw_lp *lp);
void fattree_switch_rt_sample_fn(switch_state *s, tw_lp *lp);
static void fattree_vt_sample_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp);
static void fattree_vt_sample_rc_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp);
static void fattree_vt_ssample_fn(switch_state * s, tw_bf * bf, tw_lp * lp);
static void fattree_vt_ssample_rc_fn(switch_state * s, tw_bf * bf, tw_lp * lp);
char ftree_switch_lp_name[] = "ftree_switch\0";
char ftree_terminal_lp_name[] = "ftree_terminal\0";
char* ftree_svar_names[] = {
"switch_id\0",
"vc_occupancy\0"
};
char* ftree_tvar_names[] = {
"terminal_id\0",
"vc_occupancy\0"
};
st_model_var ftree_switch_vars[] = {
{"",
MODEL_INT,
1},
{"",
MODEL_INT,
0}
};
st_model_var ftree_terminal_vars[] = {
{"",
MODEL_INT,
1},
{"",
MODEL_INT,
1}
};
#define ftree_num_tvars 2
#define ftree_num_svars 2
st_model_types fattree_model_types[] = {
{(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_cn_sample) } ,
{(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,
0 } , // updated in switch_init()
{NULL, 0, NULL, 0, NULL, NULL, 0}
{ftree_terminal_lp_name,
ftree_terminal_vars,
ftree_num_tvars,
(vts_event_f) fattree_vt_sample_fn,
(vts_revent_f) fattree_vt_sample_rc_fn,
(rt_event_f) fattree_rt_sample_fn,
(ev_trace_f) fattree_event_trace,
sizeof(int)},
{ftree_switch_lp_name,
ftree_switch_vars,
ftree_num_svars,
(vts_event_f) fattree_vt_ssample_fn,
(vts_revent_f) fattree_vt_ssample_rc_fn,
(rt_event_f) fattree_switch_rt_sample_fn,
(ev_trace_f) fattree_event_trace,
sizeof(int)},
{0}
};
/* End of ROSS model stats collection */
void ftree_terminal_init_model_vars()
{
int i;
for (i = 0; i < ftree_num_tvars; i++)
{
ftree_terminal_vars[i].var_name = ftree_tvar_names[i];
}
}
void ftree_switch_init_model_vars(int radix)
{
int i;
for (i = 0; i < ftree_num_svars; i++)
{
ftree_switch_vars[i].var_name = ftree_svar_names[i];
if (i > 0)
ftree_switch_vars[i].num_elems = radix;
}
}
void fattree_event_trace(fattree_message *m, tw_lp *lp, char *buffer, int* collect_flag)
{
(void)lp;
(void)collect_flag;
int type = (int) m->type;
memcpy(buffer, &type, sizeof(type));
}
void fattree_rt_sample_fn(ft_terminal_state *s, tw_lp *lp)
{
(void)lp;
int terminal_id = (int)s->terminal_id;
st_save_model_variable(lp, ftree_tvar_names[0], &terminal_id);
st_save_model_variable(lp, ftree_tvar_names[1], &s->vc_occupancy[0]);
}
void fattree_switch_rt_sample_fn(switch_state *s, tw_lp *lp)
{
(void)lp;
int switch_id = (int)s->switch_id;
st_save_model_variable(lp, ftree_svar_names[0], &switch_id);
st_save_model_variable(lp, ftree_svar_names[1], &s->vc_occupancy[0]);
}
static void fattree_vt_sample_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp)
{
(void)bf;
(void)lp;
(void)s;
int terminal_id = (int)s->terminal_id;
st_save_model_variable(lp, ftree_tvar_names[0], &terminal_id);
st_save_model_variable(lp, ftree_tvar_names[1], &s->vc_occupancy[0]);
}
static void fattree_vt_sample_rc_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp)
{
(void)lp;
(void)bf;
(void)s;
// state doesn't change in forward handler so nothing to do here
}
static void fattree_vt_ssample_fn(switch_state * s, tw_bf * bf, tw_lp * lp)
{
(void)lp;
(void)bf;
int switch_id = (int)s->switch_id;
st_save_model_variable(lp, ftree_svar_names[0], &switch_id);
st_save_model_variable(lp, ftree_svar_names[1], &s->vc_occupancy[0]);
}
static void fattree_vt_ssample_rc_fn(switch_state * s, tw_bf * bf, tw_lp * lp)
{
(void)lp;
(void)bf;
(void)s;
// state doesn't change in forward handler so nothing to do here
}
static const st_model_types *fattree_get_cn_model_stat_types(void)
{
return(&fattree_model_types[0]);
}
static void fattree_register_model_stats(st_model_types *base_type)
{
s