Commit bba8201b authored by Misbah Mubarak's avatar Misbah Mubarak

Adding Caitlin's vis related changes + fixing more warnings

parents 95a185b8 1348687f
## README for using ROSS instrumentation in CODES
## README for using ROSS instrumentation with CODES
For details about the ROSS instrumentation, see the [ROSS Instrumentation blog post](http://carothersc.github.io/ROSS/feature/instrumentation.html) on the ROSS webpage.
The instrumentation will be merged into the master branch of the ROSS repo very soon.
For details about the ROSS instrumentation, see the [ROSS Instrumentation blog post](http://carothersc.github.io/ROSS/feature/instrumentation.html)
on the ROSS webpage.
There are currently 3 types of instrumentation: GVT-based, real time, and event tracing. See the ROSS documentation for more info on
the specific options or use `--help` with your model. The GVT-based and real time sampling do not require any changes to your model code.
The event tracing will run without any changes, but some additions to the model code is needed in order to get specific model event types.
This document describes how to do it.
the specific options or use `--help` with your model. To collect data about the simulation engine, no changes are needed to model code
for any of the instrumentation modes. Some additions to the model code is needed in order to turn on any model-level data collection.
See the "Model-level data sampling" section on [ROSS Instrumentation blog post](http://carothersc.github.io/ROSS/feature/instrumentation.html).
Here we describe CODES specific details.
### Register LP event tracing function
### Register Instrumentation Callback Functions
The examples here are based on the server LP for the synthetic workload generation for dragonfly (`src/network-workloads/model-net-synthetic.c`).
The examples here are based on the dragonfly router and terminal LPs (`src/networks/model-net/dragonfly.c`).
As described in the ROSS Vis documentation, we need to first add our function that will save the event type (and any other desired data) to the
buffer location provided by ROSS.
As described in the ROSS Vis documentation, we need to create a `st_model_types` struct with the pointer and size information.
```C
void svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer)
{
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
```
Then we need to create a `st_trace_type` struct with the pointer and size information.
```C
st_trace_type svr_trace_types[] = {
{(rbev_trace_f) svr_event_collect,
st_model_types dragonfly_model_types[] = {
{(rbev_trace_f) dragonfly_event_collect,
sizeof(int),
(ev_trace_f) svr_event_collect,
sizeof(int)},
(ev_trace_f) dragonfly_event_collect,
sizeof(int),
(model_stat_f) dragonfly_model_stat_collect,
sizeof(tw_lpid) + sizeof(long) * 2 + sizeof(double) + sizeof(tw_stime) * 2},
{(rbev_trace_f) dragonfly_event_collect,
sizeof(int),
(ev_trace_f) dragonfly_event_collect,
sizeof(int),
(model_stat_f) dfly_router_model_stat_collect,
0}, // updated in router_setup()
{0}
}
```
`dragonfly_model_types[0]` is the function pointers for the terminal LP and `dragonfly_model_types[1]` is for the router LP.
For the first two function pointers for each LP, we use the same `dragonfly_event_collec()` because right now we just collect the event type, so
it's the same for both of these LPs. You can change these if you want to use different functions for different LP types or if you want a different
function for the full event tracing than that used for the rollback event trace (`rbev_trace_f` is for the event tracing of rollback triggering events only,
while `ev_trace_f` is for the full event tracing).
The number following each function pointer is the size of the data that will be saved when the function is called.
The third pointer is for the data to be sampled at the GVT or real time sampling points.
In this case the LPs have different function pointers since we want to collect different types of data for the two LP types.
For the terminal, I set the appropriate size of the data to be collected, but for the router, the size of the data is dependent on the radix for the
dragonfly configuration being used, which isn't known until runtime.
*Note*: You can only reuse the function for event tracing for LPs that use the same type of message struct.
For example, the dragonfly terminal and router LPs both use the `terminal_message` struct, so they can
use the same functions for event tracing. However the model net base LP uses the `model_net_wrap_msg` struct, so it gets its own event collection function and
`st_trace_type` struct, in order to read the event type correctly from the model.
And a function to return this struct
In the ROSS instrumentation documentation, there are two methods provided for letting ROSS know about these `st_model_types` structs.
In CODES, this step is a little different, as `codes_mapping_setup()` calls `tw_lp_settype()`.
Instead, you add a function to return this struct for each of your LP types:
```C
static const st_trace_type *svr_get_trace_types(void)
static const st_model_types *dragonfly_get_model_types(void)
{
return(&svr_trace_types[0]);
return(&dragonfly_model_types[0]);
}
static const st_model_types *dfly_router_get_model_types(void)
{
return(&dragonfly_model_types[1]);
}
```
As a reminder, there are two types of event tracing the full event trace (`ev_trace_f`) or only events that trigger rollbacks (`rbev_trace_f`).
It's set up so that you can have different functions for both types of event tracing, or you can use the same function for both.
Immediately after each function pointer is a `size_t` type that takes the amount of data that the function will be placing in the buffer,
so ROSS can appropriately handle things.
If you have multiple LPs, you can do a `st_trace_type` for each LP, or you can reuse. *Note*: You can only reuse `st_trace_type` and the event type collection
function for LPs that use the same type of message struct. For example, the dragonfly terminal and router LPs both use the `terminal_message` struct, so they can
use the same functions for event tracing. However the model net base LP uses the `model_net_wrap_msg` struct, so it gets its own event collection function and
`st_trace_type` struct, in order to read the event type correctly from the model.
`codes_mapping_init()` was changed to register the function pointers when it is setting up the LP types. So for CODES models, you need to add a register function:
Now you need to add register functions for CODES:
```C
void svr_register_trace()
static void dragonfly_register_model_types(st_model_types *base_type)
{
trace_type_register("server", svr_get_trace_types());
st_model_type_register(LP_CONFIG_NM_TERM, base_type);
}
```
`trace_type_register(const char* name, const st_trace_type* type)` is part of the API and lets CODES know the pointers for LP initialization.
Now in the main function, you call the register function *before* calling `codes_mapping_setup()`.
```C
if (g_st_ev_trace)
svr_register_trace();
static void router_register_model_types(st_model_types *base_type)
{
st_model_type_register(LP_CONFIG_NM_ROUT, base_type);
}
```
`st_model_type_register(const char* name, const st_trace_type* type)` is part of the CODES API and lets CODES know the pointers for LP initialization.
`g_st_ev_trace` is a ROSS flag for determining if event tracing is turned on.
At this point, there are two different steps to follow depending on whether the model is one of the model-net models or not.
That's all you need to add for each LP.
### Model Net LPs
In addition to the dragonfly synthetic server LP, I've already added in the necessary changes for both the model net base LP type and dragonfly (both router and terminal LPs),
so no other changes need to be made to those LPs. (Unless you want to collect some additional data.)
For any other network LPs that are based on the model net base LP type, there are a few additional details to know.
There are two fields added to the `model_net_method` struct for pointers to the trace registration functions for each LP.
##### Model-net Models
In the `model_net_method` struct, two fields have been added: `mn_model_stat_register` and `mn_get_model_stat_types`.
You need to set these to the functions described above. For example:
```C
void (*mn_trace_register)(st_trace_type *base_type);
const st_trace_type* (*mn_get_trace_type)();
```
struct model_net_method dragonfly_method =
{
.mn_configure = dragonfly_configure,
// ... all the usual model net stuff
.mn_model_stat_register = dragonfly_register_model_types,
.mn_get_model_stat_types = dragonfly_get_model_types,
};
For example, right now, both the dragonfly router and terminal LPs use the same `st_trace_type dragonfly_trace_types` struct and the following function to return its pointer:
```C
static const st_trace_type *dragonfly_get_trace_types(void)
struct model_net_method dragonfly_router_method =
{
return(&dragonfly_trace_types[0]);
}
.mn_configure = NULL,
// ... all the usual model net stuff
.mn_model_stat_register = router_register_model_types,
.mn_get_model_stat_types = dfly_router_get_model_types,
};
```
They have different register functions:
##### All other CODES models
Using the synthetic workload LP for dragonfly as an example (`src/network-workloads/model-net-synthetic.c`).
In the main function, you call the register function *before* calling `codes_mapping_setup()`.
```C
static void dragonfly_register_trace(st_trace_type *base_type)
st_model_types svr_model_types[] = {
{(rbev_trace_f) svr_event_collect,
sizeof(int),
(ev_trace_f) svr_event_collect,
sizeof(int),
(model_stat_f) svr_model_stat_collect,
0}, // at the moment, we're not actually collecting any data about this LP
{0}
}
static void svr_register_model_types()
{
trace_type_register(LP_CONFIG_NM_TERM, base_type);
st_model_type_register("server", &svr_model_types[0]);
}
static void router_register_trace(st_trace_type *base_type)
int main(int argc, char **argv)
{
trace_type_register(LP_CONFIG_NM_ROUT, base_type);
// ... some set up removed for brevity
model_net_register();
svr_add_lp_type();
if (g_st_ev_trace || g_st_model_stats)
svr_register_model_types();
codes_mapping_setup();
//...
}
```
And then the following additions to their `model_net_method` structs:
```C
struct model_net_method dragonfly_method =
{
// the fields already in the struct
...
// event tracing additions
.mn_trace_register = dragonfly_register_trace,
.mn_get_trace_type = dragonfly_get_trace_types,
};
`g_st_ev_trace` is a ROSS flag for determining if event tracing is turned on and `g_st_model_stats` determines if the GVT-based or real time instrumentation
modes are collecting model-level data as well.
struct model_net_method dragonfly_router_method =
{
// the fields already in the struct
...
// event tracing additions
.mn_trace_register = router_register_trace,
.mn_get_trace_type = dragonfly_get_trace_types,
};
```
Any other LPs built off of the model net LP, can be changed in the same way.
### CODES LPs that currently have event type collection implemented:
If you're using any of the following CODES models, you don't have to add anything, unless you want to change the data that's being collected.
- nw-lp (model-net-mpi-replay.c)
- original dragonfly router and terminal LPs (dragonfly.c)
- dfly server LP (model-net-synthetic.c)
- model-net-base-lp (model-net-lp.c)
- fat tree server LP (model-net-synthetic-fattree.c)
The fat-tree terminal and switch LPs (fattree.c) are only partially implemented at the moment. It needs two `model_net_method` structs to fully implement,
but currently both terminal and switch LPs use the same `fattree_method` struct.
......@@ -21,8 +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 trace_type_register(const char* name, const st_trace_type* type);
const st_trace_type* trace_type_lookup(const char* name);
void st_model_type_register(const char* name, const st_model_types* type);
const st_model_types* st_model_type_lookup(const char* name);
#ifdef __cplusplus
}
#endif
......
......@@ -63,8 +63,8 @@ struct model_net_method
revent_f mn_sample_rc_fn;
init_f mn_sample_init_fn;
final_f mn_sample_fini_fn;
void (*mn_trace_register)(st_trace_type *base_type);
const st_trace_type* (*mn_get_trace_type)();
void (*mn_model_stat_register)(st_model_types *base_type);
const st_model_types* (*mn_get_model_stat_types)();
};
extern struct model_net_method * method_array[];
......
......@@ -393,6 +393,7 @@ void model_net_set_msg_param(
/* returns pointer to LP information for simplenet module */
const tw_lptype* model_net_get_lp_type(int net_id);
const st_model_types* model_net_get_model_stat_type(int net_id);
DEPRECATED
uint64_t model_net_get_packet_size(int net_id);
......
......@@ -91,6 +91,8 @@ struct terminal_message
tw_stime saved_hist_start_time;
tw_stime saved_sample_time;
tw_stime msg_start_time;
tw_stime saved_busy_time_ross;
tw_stime saved_fin_chunks_ross;
int saved_hist_num;
int saved_occupancy;
......
......@@ -3,6 +3,9 @@
#include <ross.h>
/* Functions used for ROSS event tracing */
extern void fattree_register_evtrace();
/* Global variable for modelnet output directory name */
extern char *modelnet_stats_dir;
......
......@@ -41,7 +41,7 @@ PARAMS
# bandwidth in GiB/s for compute node-router channels
cn_bandwidth="16.0";
# ROSS message size
message_size="592";
message_size="608";
# number of compute nodes connected to router, dictated by dragonfly config
# file
num_cns_per_router="2";
......
......@@ -23,6 +23,6 @@ PARAMS
local_bandwidth="5.25";
global_bandwidth="4.7";
cn_bandwidth="5.25";
message_size="592";
message_size="608";
routing="adaptive";
}
......@@ -31,6 +31,6 @@ PARAMS
cn_bandwidth="9.0";
router_delay="0";
link_delay="0";
message_size="592";
message_size="608";
routing="minimal";
}
......@@ -10,7 +10,7 @@ LPGROUPS
PARAMS
{
packet_size="512";
message_size="592";
message_size="608";
modelnet_order=( "torus" );
# scheduler options
modelnet_scheduler="fcfs";
......
......@@ -2197,6 +2197,46 @@ static void nw_add_lp_type()
lp_type_register("nw-lp", nw_get_lp_type());
}
/* setup for the ROSS event tracing
* can have a different function for rbev_trace_f and ev_trace_f
* but right now it is set to the same function for both
*/
void nw_lp_event_collect(nw_message *m, tw_lp *lp, char *buffer, int *collect_flag)
{
int type = m->msg_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
* 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)
{
return;
}
st_model_types nw_lp_model_types[] = {
{(rbev_trace_f) nw_lp_event_collect,
sizeof(int),
(ev_trace_f) nw_lp_event_collect,
sizeof(int),
(model_stat_f) nw_lp_model_stat_collect,
0},
{0}
};
static const st_model_types *nw_lp_get_model_stat_types(void)
{
return(&nw_lp_model_types[0]);
}
void nw_lp_register_model()
{
st_model_type_register("nw-lp", nw_lp_get_model_stat_types());
}
/* end of ROSS event tracing setup */
static int msg_size_hash_compare(
void *key, struct qhash_head *link)
{
......@@ -2299,6 +2339,9 @@ int modelnet_mpi_replay(MPI_Comm comm, int* argc, char*** argv )
nw_add_lp_type();
model_net_register();
if (g_st_ev_trace || g_st_model_stats)
nw_lp_register_model();
net_ids = model_net_configure(&num_nets);
// assert(num_nets == 1);
net_id = *net_ids;
......
......@@ -120,6 +120,45 @@ tw_lptype svr_lp = {
sizeof(svr_state),
};
/* setup for the ROSS event tracing
* can have a different function for rbev_trace_f and ev_trace_f
* but right now it is set to the same function for both
*/
void ft_svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *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
* 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)
{
return;
}
st_model_types ft_svr_model_types[] = {
{(rbev_trace_f) ft_svr_event_collect,
sizeof(int),
(ev_trace_f) ft_svr_event_collect,
sizeof(int),
(model_stat_f) ft_svr_model_stat_collect,
0},
{0}
};
static const st_model_types *ft_svr_get_model_stat_types(void)
{
return(&ft_svr_model_types[0]);
}
void ft_svr_register_model_stats()
{
st_model_type_register("server", ft_svr_get_model_stat_types());
}
const tw_optdef app_opt [] =
{
TWOPT_GROUP("Model net synthetic traffic " ),
......@@ -408,6 +447,9 @@ int main(
svr_add_lp_type();
if (g_st_ev_trace)
ft_svr_register_model_stats();
codes_mapping_setup();
......
......@@ -110,28 +110,39 @@ tw_lptype svr_lp = {
* can have a different function for rbev_trace_f and ev_trace_f
* but right now it is set to the same function for both
*/
void svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer)
void svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer, int *collect_flag)
{
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
}
st_trace_type svr_trace_types[] = {
/* 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)
{
return;
}
st_model_types svr_model_types[] = {
{(rbev_trace_f) svr_event_collect,
sizeof(int),
(ev_trace_f) svr_event_collect,
sizeof(int)},
sizeof(int),
(model_stat_f) svr_model_stat_collect,
0},
{0}
};
static const st_trace_type *svr_get_trace_types(void)
static const st_model_types *svr_get_model_stat_types(void)
{
return(&svr_trace_types[0]);
return(&svr_model_types[0]);
}
void svr_register_trace()
void svr_register_model_types()
{
trace_type_register("server", svr_get_trace_types());
st_model_type_register("server", svr_get_model_stat_types());
}
const tw_optdef app_opt [] =
......@@ -393,8 +404,8 @@ int main(
model_net_register();
svr_add_lp_type();
if (g_st_ev_trace)
svr_register_trace();
if (g_st_ev_trace || g_st_model_stats)
svr_register_model_types();
codes_mapping_setup();
......
......@@ -1840,7 +1840,7 @@ void dragonfly_custom_rsample_fin(router_state * s,
"link traffic for each of the %d links (int64_t) \nsample end time (double) forward events per sample \nreverse events per sample ",
p->radix, p->radix);
fprintf(fp, "\n\nOrdering of links \n%d local (router-router same group) channels \n%d global (router-router remote group)"
" channels \n%d terminal channels", p->intra_grp_radix, p->num_global_channels);
" channels \n %d terminal channels", p->intra_grp_radix, p->num_global_channels, p->num_cn);
fclose(fp);
}
char rt_fn[MAX_NAME_LENGTH];
......
......@@ -271,6 +271,13 @@ struct terminal_state
/* for logging forward and reverse events */
long fwd_events;
long rev_events;
/* following used for ROSS model-level stats collection */
long fin_chunks_ross_sample;
long data_size_ross_sample;
long fin_hops_ross_sample;
tw_stime fin_chunks_time_ross_sample;
tw_stime busy_time_ross_sample;
};
/* terminal event type (1-4) */
......@@ -356,8 +363,34 @@ struct router_state
long fwd_events;
long rev_events;
/* following used for ROSS model-level stats collection */
tw_stime* busy_time_ross_sample;
int64_t * link_traffic_ross_sample;
};
/* had to pull some of the ROSS model stats collection stuff up here */
void dragonfly_event_collect(terminal_message *m, tw_lp *lp, char *buffer, int *collect_flag);
void dragonfly_model_stat_collect(terminal_state *s, tw_lp *lp, char *buffer);
void dfly_router_model_stat_collect(router_state *s, tw_lp *lp, char *buffer);
st_model_types dragonfly_model_types[] = {
{(rbev_trace_f) dragonfly_event_collect,
sizeof(int),
(ev_trace_f) dragonfly_event_collect,
sizeof(int),
(model_stat_f) dragonfly_model_stat_collect,
sizeof(tw_lpid) + sizeof(long) * 2 + sizeof(double) + sizeof(tw_stime) *2},
{(rbev_trace_f) dragonfly_event_collect,
sizeof(int),
(ev_trace_f) dragonfly_event_collect,
sizeof(int),
(model_stat_f) dfly_router_model_stat_collect,
0}, //updated in router_setup() since it's based on the radix
{NULL, 0, NULL, 0, NULL, 0}
};
/* End of ROSS model stats collection */
static short routing = MINIMAL;
static tw_stime dragonfly_total_time = 0;
......@@ -782,6 +815,13 @@ terminal_init( terminal_state * s,
s->in_send_loop = 0;
s->issueIdle = 0;
/* set up for ROSS stats sampling */
s->fin_chunks_ross_sample = 0;
s->data_size_ross_sample = 0;
s->fin_hops_ross_sample = 0;
s->fin_chunks_time_ross_sample = 0.0;
s->busy_time_ross_sample = 0.0;
dragonfly_collective_init(s, lp);
return;
}
......@@ -855,6 +895,12 @@ static void router_setup(router_state * r, tw_lp * lp)
r->busy_time = (tw_stime*)malloc(p->radix * sizeof(tw_stime));
r->busy_time_sample = (tw_stime*)malloc(p->radix * sizeof(tw_stime));
/* set up for ROSS stats sampling */
r->link_traffic_ross_sample = (int64_t*)calloc(p->radix, sizeof(int64_t));
r->busy_time_ross_sample = (tw_stime*)calloc(p->radix, sizeof(tw_stime));
if (g_st_model_stats)
lp->model_types->mstat_sz = sizeof(tw_lpid) + (sizeof(int64_t) + sizeof(tw_stime)) * p->radix;
rc_stack_create(&r->st);
for(int i=0; i < p->radix; i++)
{
......@@ -1263,6 +1309,7 @@ static void packet_send_rc(terminal_state * s, tw_bf * bf, terminal_message * ms
s->busy_time = msg->saved_total_time;
s->last_buf_full = msg->saved_busy_time;
s->busy_time_sample = msg->saved_sample_time;
s->busy_time_ross_sample = msg->saved_busy_time_ross;
}
}
return;
......@@ -1377,9 +1424,11 @@ static void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg,
msg->saved_total_time = s->busy_time;
msg->saved_busy_time = s->last_buf_full;
msg->saved_sample_time = s->busy_time_sample;
msg->saved_busy_time_ross = s->busy_time_ross_sample;
s->busy_time += (tw_now(lp) - s->last_buf_full);
s->busy_time_sample += (tw_now(lp) - s->last_buf_full);
s->busy_time_ross_sample += (tw_now(lp) - s->last_buf_full);
s->last_buf_full = 0.0;
}
}
......@@ -1402,12 +1451,15 @@ static void packet_arrive_rc(terminal_state * s, tw_bf * bf, terminal_message *
N_finished_chunks--;
s->finished_chunks--;
s->fin_chunks_sample--;
s->fin_chunks_ross_sample--;
total_hops -= msg->my_N_hop;
s->total_hops -= msg->my_N_hop;
s->fin_hops_sample -= msg->my_N_hop;
s->fin_hops_ross_sample -= msg->my_N_hop;
dragonfly_total_time = msg->saved_total_time;
s->fin_chunks_time = msg->saved_sample_time;
s->fin_chunks_time_ross_sample = msg->saved_fin_chunks_ross;
s->total_time = msg->saved_avg_time;
struct qhash_head * hash_link = NULL;
......@@ -1444,6 +1496,7 @@ static void packet_arrive_rc(terminal_state * s, tw_bf * bf, terminal_message *
total_msg_sz -= msg->total_size;
s->total_msg_size -= msg->total_size;
s->data_size_sample -= msg->total_size;
s->data_size_ross_sample -= msg->total_size;
struct dfly_qhash_entry * d_entry_pop = rc_stack_pop(s->st);
qhash_add(s->rank_tbl, &key, &(d_entry_pop->hash_link));
......@@ -1566,6 +1619,7 @@ static void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg
s->finished_chunks++;
/* Finished chunks per sample */
s->fin_chunks_sample++;
s->fin_chunks_ross_sample++;
/* WE do not allow self messages through dragonfly */
assert(lp->gid != msg->src_terminal_id);
......@@ -1595,6 +1649,8 @@ static void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg
/* save the sample time */
msg->saved_sample_time = s->fin_chunks_time;
s->fin_chunks_time += (tw_now(lp) - msg->travel_start_time);
msg->saved_fin_chunks_ross = s->fin_chunks_time_ross_sample;
s->fin_chunks_time_ross_sample += (tw_now(lp) - msg->travel_start_time);
/* save the total time per LP */
msg->saved_avg_time = s->total_time;
......@@ -1605,6 +1661,7 @@ static void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg
total_hops += msg->my_N_hop;
s->total_hops += msg->my_N_hop;
s->fin_hops_sample += msg->my_N_hop;
s->fin_hops_ross_sample += msg->my_N_hop;
mn_stats* stat = model_net_find_stats(msg->category, s->dragonfly_stats_array);
msg->saved_rcv_time = stat->recv_time;
......@@ -1687,6 +1744,7 @@ static void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg
s->total_msg_size += msg->total_size;
s->finished_msgs++;
s->data_size_sample += msg->total_size;
s->data_size_ross_sample += msg->total_size;
if(tmp->remote_event_data && tmp->remote_event_size > 0) {
bf->c8 = 1;
......@@ -2891,11 +2949,13 @@ static void router_packet_send_rc(router_state * s,
{
s->link_traffic[output_port] -= cur_entry->msg.packet_size % s->params->chunk_size;
s->link_traffic_sample[output_port] -= cur_entry->msg.packet_size % s->params->chunk_size;
s->link_traffic_ross_sample[output_port] -= cur_entry->msg.packet_size % s->params->chunk_size;
}
if(bf->c12)
{
s->link_traffic[output_port] -= s->params->chunk_size;
s->link_traffic_sample[output_port] -= s->params->chunk_size;
s->link_traffic_ross_sample[output_port] -= s->params->chunk_size;
}
s->next_output_available_time[output_port] = msg->saved_available_time;
......@@ -3019,10 +3079,13 @@ router_packet_send( router_state * s,
s->params->chunk_size);
s->link_traffic_sample[output_port] += (cur_entry->msg.packet_size %
s->params->chunk_size);
s->link_traffic_ross_sample[output_port] += (cur_entry->msg.packet_size %
s->params->chunk_size);
} else {
bf->c12 = 1;
s->link_traffic[output_port] += s->params->chunk_size;
s->link_traffic_sample[output_port] += s->params->chunk_size;
s->link_traffic_ross_sample[output_port] += s->params->chunk_size;
}
if(routing == PROG_ADAPTIVE)
......@@ -3091,6 +3154,7 @@ static void router_buf_update_rc(router_state * s,
{
s->busy_time[indx] = msg->saved_rcv_time;
s->busy_time_sample[indx] = msg->saved_sample_time;
s->busy_time_ross_sample[indx] = msg->saved_busy_time_ross;
s->last_buf_full[indx] = msg->saved_busy_time;
}
if(bf->c1) {
......@@ -3120,8 +3184,10 @@ static void router_buf_update(router_state * s, tw_bf * bf, terminal_message * m
msg->saved_rcv_time = s->busy_time[indx];
msg->saved_busy_time = s->last_buf_full[indx];
msg->saved_sample_time = s->busy_time_sample[indx];
msg->saved_busy_time_ross = s->busy_time_ross_sample[indx];
s->busy_time[indx] += (tw_now(lp) - s->last_buf_full[indx]);
s->busy_time_sample[indx] += (tw_now(lp) - s->last_buf_full[indx]);
s->busy_time_ross_sample[indx] += (tw_now(lp) - s->last_buf_full[indx]);
s->last_buf_full[indx] = 0.0;
}
if(s->queued_msgs[indx][output_chan] != NULL) {
......@@ -3282,35 +3348,104 @@ tw_lptype dragonfly_lps[] =
};
/* For ROSS event tracing */
void dragonfly_event_collect(terminal_message *m, tw_lp *lp, char *buffer)
void dragonfly_event_collect(terminal_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));
}
st_trace_type dragonfly_trace_types[] = {
{(rbev_trace_f) dragonfly_event_collect,
sizeof(int),
(ev_trace_f) dragonfly_event_collect,
sizeof(int)},
{0}
};
void dragonfly_model_stat_collect(terminal_state *s, tw_lp *lp, char *buffer)