Commit 6c92a8b9 authored by Caitlin Ross's avatar Caitlin Ross

some fixes for collecting all event data

parent befb2c49
......@@ -13,8 +13,8 @@ extern "C" {
#include <ross.h>
void dragonfly_register_evcol();
void router_register_evcol();
extern void dragonfly_register_evcol();
extern void router_register_evcol();
typedef struct terminal_message terminal_message;
......
......@@ -15,6 +15,7 @@
#include "codes/codes_mapping.h"
#include "codes/configuration.h"
#include "codes/lp-type-lookup.h"
#include "codes/net/dragonfly.h"
#define PAYLOAD_SZ 2048
......@@ -105,17 +106,27 @@ tw_lptype svr_lp = {
sizeof(svr_state),
};
void rb_svr_event_collect(svr_msg *m, char *buffer)
void rb_svr_event_collect(svr_msg *m, tw_lp *lp, char *buffer)
{
int type = (int) m->svr_event_type;
memcpy(buffer, &type, sizeof(type));
if(type < 0 || type > 3)
{
char grp_name[64];
char dest_lp_type_name[64];
char ann[64];
int grp_index, lp_type_idx, rid, offs;
codes_mapping_get_lp_info(lp->gid, grp_name, &grp_index, dest_lp_type_name,
&lp_type_idx, ann, &rid, &offs);
printf("dest: %s, recv_ts= %f, evtype: %d\n", dest_lp_type_name, tw_now(lp), type);
}
}
st_event_collect svr_event_types[] = {
{(rbev_col_f) rb_svr_event_collect,
sizeof(int),
(ev_col_f) NULL,
0},
(ev_col_f) rb_svr_event_collect,
sizeof(int)},
{0}
};
......@@ -388,7 +399,7 @@ int main(
model_net_register();
svr_add_lp_type();
if (g_st_ev_rb_collect)
if (g_st_ev_rb_collect || g_st_ev_collect)
{
dragonfly_register_evcol();
router_register_evcol();
......
......@@ -3256,17 +3256,31 @@ tw_lptype dragonfly_lps[] =
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0},
};
void rb_event_collect(terminal_message *m, char *buffer)
void rb_event_collect(terminal_message *m, tw_lp *lp, char *buffer)
{
int type = (int) m->type;
memcpy(buffer, &type, sizeof(type));
if(type < 0 || type > 10)
{
tw_event *cev = (tw_event*)(m - 1);
char grp_name[64];
char src_lp_type_name[64];
char dest_lp_type_name[64];
char ann[64];
int grp_index, lp_type_idx, rid, offs;
codes_mapping_get_lp_info(cev->send_lp, grp_name, &grp_index, src_lp_type_name,
&lp_type_idx, ann, &rid, &offs);
codes_mapping_get_lp_info(lp->gid, grp_name, &grp_index, dest_lp_type_name,
&lp_type_idx, ann, &rid, &offs);
printf("src: %s, dest: %s, recv_ts= %f, evtype: %d\n", src_lp_type_name, dest_lp_type_name, tw_now(lp), m->type);
}
}
st_event_collect event_types[] = {
{(rbev_col_f) rb_event_collect,
sizeof(int),
(ev_col_f) NULL,
0},
(ev_col_f) rb_event_collect,
sizeof(int)},
{0}
};
......
......@@ -489,7 +489,7 @@ static void codes_mapping_init(void)
else
/* sorry, const... */
tw_lp_settype(ross_lid, (tw_lptype*) lptype);
if (g_st_ev_rb_collect)
if (g_st_ev_rb_collect || g_st_ev_collect)
{
ev_type = evcol_type_lookup(lp_type_name);
st_evcol_settype(ross_lid, (st_event_collect*) ev_type);
......
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