6 #include "functional_trace.h"
\r
7 #include "Performance_Extraction.h"
\r
9 #ifdef INCLUDE_PERFORMANCE
\r
10 #define DOL_write(port, buf, len, process) {\
\r
11 (static_cast<ProcessWrapper *>(p->wptr))->end_line = __LINE__;\
\r
12 get_current_time(&((static_cast<ProcessWrapper *>(p->wptr))->\
\r
14 performance_extraction.add_computation_performance(\
\r
15 (static_cast<ProcessWrapper *>(p->wptr))->basename(),\
\r
16 (static_cast<ProcessWrapper *>(p->wptr))->start_line,\
\r
17 (static_cast<ProcessWrapper *>(p->wptr))->end_line,\
\r
18 &((static_cast<ProcessWrapper *>(p->wptr))->start_time),\
\r
19 &((static_cast<ProcessWrapper *>(p->wptr))->end_time));\
\r
20 write(port, buf, len, process);\
\r
21 (static_cast<ProcessWrapper *>(p->wptr))->start_line = __LINE__;\
\r
22 get_current_time(&((static_cast<ProcessWrapper *>(p->wptr))->\
\r
24 #define DOL_read(port, buf, len, process) {\
\r
25 (static_cast<ProcessWrapper *>(p->wptr))->end_line = __LINE__;\
\r
26 get_current_time(&((static_cast<ProcessWrapper *>(p->wptr))->\
\r
28 performance_extraction.add_computation_performance(\
\r
29 (static_cast<ProcessWrapper *>(p->wptr))->basename(),\
\r
30 (static_cast<ProcessWrapper *>(p->wptr))->start_line,\
\r
31 (static_cast<ProcessWrapper *>(p->wptr))->end_line,\
\r
32 &((static_cast<ProcessWrapper *>(p->wptr))->start_time),\
\r
33 &((static_cast<ProcessWrapper *>(p->wptr))->end_time));\
\r
34 read(port, buf, len, process);\
\r
35 (static_cast<ProcessWrapper *>(p->wptr))->start_line = __LINE__;\
\r
36 get_current_time(&((static_cast<ProcessWrapper *>(p->wptr))->\
\r
39 #define DOL_write(port, buf, len, process) {\
\r
40 (static_cast<ProcessWrapper *>(p->wptr))->end_line = __LINE__;\
\r
41 dol_functional_trace.create_computation_event(\
\r
42 (static_cast<ProcessWrapper *>(p->wptr))->basename(),\
\r
43 (static_cast<ProcessWrapper *>(p->wptr))->start_line,\
\r
44 (static_cast<ProcessWrapper *>(p->wptr))->end_line);\
\r
45 write(port, buf, len, process);\
\r
46 dol_functional_trace.create_write_event(\
\r
47 (static_cast<ProcessWrapper *>(p->wptr))->basename(), len,\
\r
48 (static_cast<ProcessWrapper *>(p->wptr))->channel_name);\
\r
49 (static_cast<ProcessWrapper *>(p->wptr))->start_line = __LINE__; }
\r
50 #define DOL_read(port, buf, len, process) {\
\r
51 (static_cast<ProcessWrapper *>(p->wptr))->end_line = __LINE__;\
\r
52 dol_functional_trace.create_computation_event(\
\r
53 (static_cast<ProcessWrapper *>(p->wptr))->basename(),\
\r
54 (static_cast<ProcessWrapper *>(p->wptr))->start_line,\
\r
55 (static_cast<ProcessWrapper *>(p->wptr))->end_line);\
\r
56 read(port, buf, len, process);\
\r
57 dol_functional_trace.create_read_event(\
\r
58 (static_cast<ProcessWrapper *>(p->wptr))->basename(), len,\
\r
59 (static_cast<ProcessWrapper *>(p->wptr))->channel_name);\
\r
60 (static_cast<ProcessWrapper *>(p->wptr))->start_line = __LINE__; }
\r
62 #define DOL_write(port, buf, len, process) \
\r
63 write(port, buf, len, process)
\r
64 #define DOL_read(port, buf, len, process) \
\r
65 read(port, buf, len, process)
\r
68 #define DOL_reserve(port, buf, size, process) \
\r
69 reserve(port, (void**)buf, size, process);
\r
71 #define DOL_release(port, process) \
\r
72 release(port, process);
\r
74 #define DOL_capture(port, buf, size, process) \
\r
75 capture(port, (void**)buf, size, process);
\r
77 #define DOL_consume(port, process) \
\r
78 consume(port, process);
\r
80 #define DOL_wtest(port, len, process) wtest(port, len, process)
\r
82 #define DOL_rtest(port, len, process) rtest(port, len, process)
\r
84 void DOL_detach(DOLProcess* p);
\r
86 //fifo access functions
\r
87 unsigned write(void* fifo, void* buf, unsigned len, DOLProcess* p);
\r
88 unsigned read(void* fifo, void* buf, unsigned len, DOLProcess* p);
\r
89 int wtest(void *port, unsigned len, DOLProcess *process);
\r
90 int rtest(void *port, unsigned len, DOLProcess *process);
\r
92 //windowed fifo access functions
\r
93 unsigned reserve(void* fifo, void** destination, unsigned len, DOLProcess* p);
\r
94 void release(void* fifo, DOLProcess* p);
\r
95 unsigned capture(void* fifo, void** destination, unsigned len, DOLProcess* p);
\r
96 void consume(void* fifo, DOLProcess* p);
\r
99 void createPort(void **port,
\r
101 int number_of_indices,
\r
102 int index0, int range0);
\r
104 void createPort(void **port,
\r
106 int number_of_indices,
\r
107 int index0, int range0,
\r
108 int index1, int range1);
\r
110 void createPort(void **port,
\r
112 int number_of_indices,
\r
113 int index0, int range0,
\r
114 int index1, int range1,
\r
115 int index2, int range2);
\r
117 void createPort(void **port,
\r
119 int number_of_indices,
\r
120 int index0, int range0,
\r
121 int index1, int range1,
\r
122 int index2, int range2,
\r
123 int index3, int range3);
\r
125 #define GETINDEX(dimension) \
\r
126 static_cast<ProcessWrapper *>(p->wptr)->getIndex(dimension)
\r
129 * macro to create a variable to store a port name
\r
131 * @param name name of the variable
\r
133 #define CREATEPORTVAR(name) Fifo *name
\r
136 * Create the port name of an iterated port based on its basename and the
\r
139 * @param port buffer where the result is stored (created using
\r
141 * @param base basename of the port
\r
142 * @param number_of_indices number of dimensions of the port
\r
143 * @param index_range_pairs index and range values for each dimension
\r
145 #define CREATEPORT(port, base, number_of_indices, index_range_pairs...) \
\r
146 createPort((void**)(&port), base, number_of_indices, index_range_pairs)
\r