Commit 92433ec4 authored by Caitlin Ross's avatar Caitlin Ross

Merge branch 'analysis-lp' into codes-nemo-sampling

parents 1114973a 71b1dd55
......@@ -156,8 +156,11 @@ 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, 0}
{NULL, 0, NULL, 0, NULL, 0, NULL, NULL, 0}
};
static const st_model_types *ft_svr_get_model_stat_types(void)
......@@ -471,7 +474,7 @@ int main(
svr_add_lp_type();
if (g_st_ev_trace)
if (g_st_ev_trace || g_st_model_stats || g_st_use_analysis_lps)
ft_svr_register_model_stats();
codes_mapping_setup();
......
......@@ -297,17 +297,26 @@ struct switch_state
};
/* ROSS Instrumentation Support */
struct fattree_sample
struct fattree_cn_sample
{
tw_lpid lpid;
tw_lpid terminal_id;
tw_stime end_time;
int vc_occupancy;
};
struct fattree_switch_sample
{
tw_lpid switch_id;
int *vc_occupancy;
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_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);
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);
st_model_types fattree_model_types[] = {
{(rbev_trace_f) fattree_event_collect,
......@@ -318,7 +327,7 @@ st_model_types fattree_model_types[] = {
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) } ,
sizeof(struct fattree_cn_sample) } ,
{(rbev_trace_f) fattree_event_collect,
sizeof(int),
(ev_trace_f) fattree_event_collect,
......@@ -327,7 +336,7 @@ st_model_types fattree_model_types[] = {
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) } ,
0 } , // updated in switch_init()
{NULL, 0, NULL, 0, NULL, 0, NULL, NULL, 0}
};
/* End of ROSS model stats collection */
......@@ -1166,6 +1175,10 @@ void switch_init(switch_state * r, tw_lp * lp)
r->busy_time = (tw_stime*)malloc(r->radix * sizeof(tw_stime));
r->busy_time_sample = (tw_stime*)malloc(r->radix * sizeof(tw_stime));
// ROSS Instrumentation
if (g_st_use_analysis_lps)
lp->model_types->sample_struct_sz = sizeof(struct fattree_switch_sample) + sizeof(int) * r->radix;
rc_stack_create(&r->st);
for(int i = 0; i < r->radix; i++)
......@@ -3038,17 +3051,17 @@ void fattree_model_stat_collect(ft_terminal_state *s, tw_lp *lp, char *buffer)
return;
}
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_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp, struct fattree_cn_sample *sample)
{
(void)lp;
(void)bf;
(void)s;
(void)sample;
sample->terminal_id = s->terminal_id;
sample->end_time = tw_now(lp);
sample->vc_occupancy = s->vc_occupancy[0];
return;
}
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_sample_rc_fn(ft_terminal_state * s, tw_bf * bf, tw_lp * lp, struct fattree_cn_sample *sample)
{
(void)lp;
(void)bf;
......@@ -3058,17 +3071,23 @@ static void ross_fattree_sample_rc_fn(ft_terminal_state * s, tw_bf * bf, tw_lp *
return;
}
static void ross_fattree_ssample_fn(switch_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_switch_sample *sample)
{
(void)lp;
(void)bf;
(void)s;
(void)sample;
int i;
sample->switch_id = s->switch_id;
sample->end_time = tw_now(lp);
sample->vc_occupancy = (int*)((&sample->end_time) + 1);
for (i = 0; i < s->radix; i++)
sample->vc_occupancy[i] = s->vc_occupancy[i];
return;
}
static void ross_fattree_ssample_rc_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_switch_sample *sample)
{
(void)lp;
(void)bf;
......@@ -3078,7 +3097,7 @@ static void ross_fattree_ssample_rc_fn(switch_state * s, tw_bf * bf, tw_lp * lp,
return;
}
static const st_model_types *fattree_get_model_stat_types(void)
static const st_model_types *fattree_get_cn_model_stat_types(void)
{
return(&fattree_model_types[0]);
}
......@@ -3105,7 +3124,7 @@ struct model_net_method fattree_method =
.mn_collective_call = NULL,
.mn_collective_call_rc = NULL,
.mn_model_stat_register = fattree_register_model_stats,
.mn_get_model_stat_types = fattree_get_model_stat_types
.mn_get_model_stat_types = fattree_get_cn_model_stat_types
};
#ifdef ENABLE_CORTEX
......
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