Revision 5f3adef4 tests/MonTestDist/MonTestDist.c

View differences:

tests/MonTestDist/MonTestDist.c
15 15

  
16 16
#define MSG_TYPE 3
17 17

  
18
char request[] = "AHi Kai thisis a request (Ping) ...";
18
char request[] = "APingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPingPing";
19 19

  
20
char reply[] = "B ...and thisis the reply (Pong)!";
20
char reply[] = "BPong";
21 21
//Note first characters identifies Request form Replies and must be maintaned (it is not printed out)
22 22

  
23 23
struct peer_info {
......
49 49
	t->tv_usec = (unsigned long)fmod(p, 100000.0);
50 50
}
51 51

  
52
int generic = -1;
53
int sn = 0;
54

  
52 55

  
53 56
/* Event to send periodically traffic after the connection has been established */
54 57
void send_data_cb(int fd, short event,void *arg){
......
66 69

  
67 70
	mlSendData(peer->con_id, request, strlen(request) + 1, MSG_TYPE, NULL);
68 71

  
72
	if(generic >= 0)
73
		monNewSample(generic, sn++);
74

  
69 75
	gen_pause(&t);
70 76
	//reschedule
71 77
	event_base_once(eventbase, -1, EV_TIMEOUT, &send_data_cb, arg, &t);
......
77 83
	struct timeval t = {0,0};
78 84
	struct peer_info *peer = (struct peer_info *) arg;
79 85
	enum stat_types st[] = {AVG, MIN, MAX};
80
	enum stat_types st2[] = {AVG};
86
	enum stat_types st2[] = {RATE};
81 87
	int i=0, ret;
82 88

  
83 89
	peer->con_id = connectionID;
......
94 100
	ret = peer->m_list[i] = monCreateMeasure(HOPCOUNT, PACKET | IN_BAND);
95 101
	ret = monPublishStatisticalType(peer->m_list[i], NULL, channel, st , sizeof(st)/sizeof(enum stat_types), repoclient);
96 102
//	monSetParameter (peer->m_list[i], P_PUBLISHING_RATE, 30);
97
//	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
103
	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
104
	ret = monActivateMeasure(peer->m_list[i], peer->rem_peer, MSG_TYPE);
105
	i++;
106

  
107
	/* Clockdrift and capacity */
108
	ret = peer->m_list[i] = monCreateMeasure(CLOCKDRIFT, PACKET | IN_BAND);
109
	ret = monSetParameter (peer->m_list[i], P_CLOCKDRIFT_ALGORITHM, 1);
110
	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
111
	ret = monActivateMeasure(peer->m_list[i],peer->rem_peer, MSG_TYPE);
112
	i++;
113

  
114
	ret = peer->m_list[i] = monCreateMeasure(CORRECTED_DELAY, PACKET | IN_BAND);
115
	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
116
	ret = monActivateMeasure(peer->m_list[i],peer->rem_peer, MSG_TYPE);
117
	i++;
118

  
119
	ret = peer->m_list[i] = monCreateMeasure(CAPACITY_CAPPROBE, PACKET | IN_BAND);
120
	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
121
	ret = monSetParameter (peer->m_list[i], P_CAPPROBE_DELAY_TH, -1);
122
// 	monSetParameter (mh, P_CAPPROBE_PKT_TH, 100);
123
// 	monSetParameter (mh, P_CAPPROBE_IPD_TH, 60);
124
// 	monPublishStatisticalType(mh, NULL, channel, st , sizeof(st)/sizeof(enum stat_types), repoclient);
125
 	ret = monActivateMeasure(peer->m_list[i],peer->rem_peer, MSG_TYPE);
126
	i++;
127

  
128
	ret = peer->m_list[i] = monCreateMeasure(TX_BYTE, PACKET | IN_BAND);
129
	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
130
	ret = monPublishStatisticalType(peer->m_list[i], NULL, channel, st2, sizeof(st2)/sizeof(enum stat_types), repoclient);
98 131
	ret = monActivateMeasure(peer->m_list[i], peer->rem_peer, MSG_TYPE);
99 132
	i++;
100 133

  
101
// 	/* Clockdrift and capacity */
102
// 	ret = peer->m_list[i] = monCreateMeasure(CLOCKDRIFT, PACKET | IN_BAND);
103
// 	ret = monSetParameter (peer->m_list[i], P_CLOCKDRIFT_ALGORITHM, 1);
104
// 	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
105
// 	ret = monActivateMeasure(peer->m_list[i],peer->rem_peer, MSG_TYPE);
106
// 	i++;
107
// 
108
// 	ret = peer->m_list[i] = monCreateMeasure(CORRECTED_DELAY, PACKET | IN_BAND);
109
// 	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
110
// 	ret = monActivateMeasure(peer->m_list[i],peer->rem_peer, MSG_TYPE);
111
// 	i++;
112
// 
113
// 	ret = peer->m_list[i] = monCreateMeasure(CAPACITY_CAPPROBE, PACKET | IN_BAND);
114
// 	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
115
// 	ret = monSetParameter (peer->m_list[i], P_CAPPROBE_DELAY_TH, -1);
116
// // 	monSetParameter (mh, P_CAPPROBE_PKT_TH, 100);
117
// // 	monSetParameter (mh, P_CAPPROBE_IPD_TH, 60);
118
// // 	monPublishStatisticalType(mh, NULL, channel, st , sizeof(st)/sizeof(enum stat_types), repoclient);
119
//  	ret = monActivateMeasure(peer->m_list[i],peer->rem_peer, MSG_TYPE);
120
// 	i++;
121
// 
122
// 	ret = peer->m_list[i] = monCreateMeasure(TX_BYTE, PACKET | IN_BAND);
123
// 	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
124
// 	ret = monPublishStatisticalType(peer->m_list[i], NULL, channel, st2, sizeof(st2)/sizeof(enum stat_types), repoclient);
125
// 	ret = monActivateMeasure(peer->m_list[i], peer->rem_peer, MSG_TYPE);
126
// 	i++;
127
// 
128
// 	ret = peer->m_list[i] = monCreateMeasure(RX_BYTE, PACKET | IN_BAND);
129
// 	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
130
// 	ret = monPublishStatisticalType(peer->m_list[i], NULL, channel, st2, sizeof(st2)/sizeof(enum stat_types), repoclient);
131
// 	ret = monActivateMeasure(peer->m_list[i], peer->rem_peer, MSG_TYPE);
132
// 	i++;
134
	ret = peer->m_list[i] = monCreateMeasure(RX_BYTE, PACKET | IN_BAND);
135
	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
136
	ret = monPublishStatisticalType(peer->m_list[i], NULL, channel, st2, sizeof(st2)/sizeof(enum stat_types), repoclient);
137
	ret = monActivateMeasure(peer->m_list[i], peer->rem_peer, MSG_TYPE);
138
	i++;
133 139

  
134 140
	/* Seqwin */
135 141
	ret = peer->m_list[i] = monCreateMeasure(SEQWIN, DATA | IN_BAND);
136
//	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
142
	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
137 143
// 	monSetParameter (peer->m_list[i], P_WINDOW_SIZE, 100);
138 144
// 	monSetParameter (peer->m_list[i], P_PUBLISHING_RATE, 100);
139 145
// 	monPublishStatisticalType(peer->m_list[i], NULL, channel, st , sizeof(st)/sizeof(enum stat_types), repoclient);
......
142 148

  
143 149
	/* Loss */
144 150
	ret = peer->m_list[i] = monCreateMeasure(LOSS, DATA | IN_BAND);
145
//	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
151
	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
146 152
// 	monSetParameter (peer->m_list[i], P_WINDOW_SIZE, 100);
147 153
// 	monSetParameter (peer->m_list[i], P_PUBLISHING_RATE, 100);
148
	monPublishStatisticalType(peer->m_list[i], NULL, channel, st2 , sizeof(st2)/sizeof(enum stat_types), repoclient);
154
// 	monPublishStatisticalType(peer->m_list[i], NULL, channel, st , sizeof(st)/sizeof(enum stat_types), repoclient);
149 155
	ret = monActivateMeasure(peer->m_list[i], peer->rem_peer, MSG_TYPE);
150 156
	i++;
151 157

  
152 158
	/* Loss Burst */
153 159
	ret = peer->m_list[i] = monCreateMeasure(LOSS_BURST, DATA | IN_BAND);
154
//	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
160
	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
155 161
//	monSetParameter (peer->m_list[i], P_WINDOW_SIZE, 100);
156 162
//	monSetParameter (peer->m_list[i], P_PUBLISHING_RATE, 100);
157
	monPublishStatisticalType(peer->m_list[i], NULL, channel, st , sizeof(st)/sizeof(enum stat_types), repoclient);
163
//	monPublishStatisticalType(peer->m_list[i], NULL, channel, st , sizeof(st)/sizeof(enum stat_types), repoclient);
158 164
	ret = monActivateMeasure(peer->m_list[i], peer->rem_peer, MSG_TYPE);
159 165
	i++;
160 166

  
161 167
	/* Round trip time */
162 168
	ret = peer->m_list[i] = monCreateMeasure(RTT, DATA | IN_BAND);
163 169
//	monSetParameter (peer->m_list[i], P_PUBLISHING_RATE, 100);
164
	monPublishStatisticalType(peer->m_list[i], NULL, channel, st , sizeof(st)/sizeof(enum stat_types), repoclient);
165
//	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
170
//	monPublishStatisticalType(peer->m_list[i], NULL, channel, st , sizeof(st)/sizeof(enum stat_types), repoclient);
171
	ret = monSetParameter (peer->m_list[i], P_DEBUG_FILE, 1);
166 172
	ret = monActivateMeasure(peer->m_list[i], peer->rem_peer, MSG_TYPE);
167 173
	i++;
168 174

  
......
195 201
	int i, ret;
196 202
	send_params sParams;
197 203
	struct peer_info *t;
204
	enum stat_types st[] = {MIN, MAX};
205

  
206
	generic = monCreateMeasure(GENERIC, 0);
207
	ret = monSetParameter (generic, P_DEBUG_FILE, 1);
208
	ret = monPublishStatisticalType(generic, "GenericTest", channel, st , sizeof(st)/sizeof(enum stat_types), repoclient);
209
	ret = monActivateMeasure(generic, NULL, MSG_TYPE);
198 210

  
199 211
	for(i=0; i < p_len; i++) {
200 212
		if(strcmp(local_id, peers[i]) == 0)
......
229 241
	int i;
230 242
	struct peer_info *t;
231 243

  
244
	monDestroyMeasure(generic);
245
	generic = -1;
246
	sn = 0;
247

  
232 248
	/* Stop any running measurments and free up memory */
233 249
	while(peers_head != NULL) {
234 250
		for(i=0; i < peers_head->m_list_len; i++) {

Also available in: Unified diff