ROSS
st-event-trace.c
Go to the documentation of this file.
1#include <ross.h>
2
4
5static short evtype_warned = 0;
6
7// collect src LP, dest LP, virtual time stamp, real time start
8// model can implement callback function to collect model level data, e.g. event type
9void st_collect_event_data(tw_event *cev, double recv_rt)
10{
11 tw_clock start_cycle_time = tw_clock_read();
12 int collect_flag = 1;
13 st_event_data ev_data;
14 ev_data.src_lp = (unsigned int) cev->send_lp;
15 ev_data.dest_lp = (unsigned int) cev->dest_lp->gid;
16 ev_data.send_vts = (float) TW_STIME_DBL(cev->send_ts);
17 ev_data.recv_vts = (float) TW_STIME_DBL(cev->recv_ts);
18 ev_data.real_ts = (float) recv_rt;
19 int total_sz = sizeof(ev_data);
20
22 {
23 fprintf(stderr, "WARNING: node: %ld: %s:%i: ", g_tw_mynode, __FILE__, __LINE__);
24 fprintf(stderr, "The struct st_model_types has not been defined! No model level data will be collected\n");
25 evtype_warned = 1;
26 }
27
29 ev_data.model_data_sz = cev->dest_lp->model_types->ev_sz;
30 else
31 ev_data.model_data_sz = 0;
32
33
34 total_sz += ev_data.model_data_sz;
35 char buffer[total_sz];
36
37 if (ev_data.model_data_sz > 0)
38 (*cev->dest_lp->model_types->ev_trace)(tw_event_data(cev), cev->dest_lp, &buffer[sizeof(ev_data)], &collect_flag);
39
40 if (collect_flag)
41 {
42 memcpy(&buffer[0], &ev_data, sizeof(ev_data));
44 st_buffer_push(EV_TRACE, &buffer[0], total_sz);
46 fwrite(buffer, total_sz, 1, seq_ev_trace);
47
48 }
49 g_tw_pe->stats.s_stat_comp += tw_clock_read() - start_cycle_time;
50}
static tw_clock tw_clock_read(void)
Definition aarch64.h:8
uint64_t tw_clock
Definition aarch64.h:6
@ EV_TRACE
void st_buffer_push(int type, char *data, int size)
FILE * seq_ev_trace
int g_st_ev_trace
int g_st_disable_out
#define TW_STIME_DBL(x)
Definition ross-base.h:42
static void * tw_event_data(tw_event *event)
tw_pe * g_tw_pe
Definition ross-global.c:79
tw_peid g_tw_mynode
Definition ross-global.c:92
tw_peid g_tw_masternode
Definition ross-global.c:93
tw_synch g_tw_synchronization_protocol
Definition ross-global.c:19
@ SEQUENTIAL
Definition ross-types.h:37
void st_collect_event_data(tw_event *cev, double recv_rt)
static short evtype_warned
unsigned int src_lp
unsigned int dest_lp
unsigned int model_data_sz
size_t ev_sz
size of data collected from model for each event
ev_trace_f ev_trace
function pointer to collect data about all events for given LP
Event Stucture.
Definition ross-types.h:277
tw_stime recv_ts
Actual time to be received.
Definition ross-types.h:314
tw_stime send_ts
Definition ross-types.h:319
tw_lpid send_lp
sending LP ID for data collection uses
Definition ross-types.h:317
tw_lp * dest_lp
Destination LP ID.
Definition ross-types.h:312
struct st_model_types * model_types
Definition ross-types.h:355
tw_lpid gid
global LP id
Definition ross-types.h:338