Revision 59e70a74 measures-monl.c

View differences:

measures-monl.c
39 39
//static MonHandler rx_chunks, tx_chunks;
40 40

  
41 41
/*
42
 * Initialize one measure
42
 * Start one measure
43 43
*/
44
void add_measure(MonHandler *mh, MeasurementId id, MeasurementCapabilities mc, MonParameterValue rate, const char *pubname, enum stat_types st[], int length, SocketId dst, MsgType mt)
44
void start_measure(MonHandler mh, MonParameterValue rate, const char *pubname, enum stat_types st[], int length, SocketId dst, MsgType mt)
45 45
{
46
	*mh = monCreateMeasure(id, mc);
47
	if (rate) monSetParameter (*mh, P_PUBLISHING_RATE, rate);
48
	if (length) monPublishStatisticalType(*mh, pubname, channel_get_name(), st , length, NULL);
49
	monActivateMeasure(*mh, dst, mt);
46
	if (rate) monSetParameter (mh, P_PUBLISHING_RATE, rate);
47
	if (length) monPublishStatisticalType(mh, pubname, channel_get_name(), st , length, NULL);
48
	monActivateMeasure(mh, dst, mt);
49
}
50

  
51
/*
52
 * Initialize and start one measure
53
 */
54
void add_measure(MonHandler *mhp, MeasurementId id, MeasurementCapabilities mc, MonParameterValue rate, const char *pubname, enum stat_types st[], int length, SocketId dst, MsgType mt)
55
{
56
	*mhp = monCreateMeasure(id, mc);
57
	start_measure(*mhp, rate, pubname, st, length, dst, mt);
50 58
}
51 59

  
52 60
/*
......
205 213

  
206 214
	/* HopCount */
207 215
	// number of hops at IP level
208
       add_measure(&id->mhs[j++], HOPCOUNT, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "HopCount", stwinavg, sizeof(stwinavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[IP hops]
216
       id->mhs[j] = monCreateMeasure(HOPCOUNT, PACKET | IN_BAND);
217
       start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "HopCount", stwinavg, sizeof(stwinavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[IP hops]
209 218

  
210 219
	/* Round Trip Time */
211
       add_measure(&id->mhs[j++], RTT, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "RoundTripDelay", stwinavgwinvar, sizeof(stwinavgwinvar)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[seconds]
220
       id->mhs[j] = monCreateMeasure(RTT, PACKET | IN_BAND);
221
       start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "RoundTripDelay", stwinavgwinvar, sizeof(stwinavgwinvar)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[seconds]
212 222

  
213 223
	/* Loss */
214
       add_measure(&id->mhs[j++], SEQWIN, PACKET | IN_BAND, 0, NULL, NULL, 0, id->addr, MSG_TYPE_CHUNK);
215
       add_measure(&id->mhs[j++], LOSS, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "LossRate", stwinavg, sizeof(stwinavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//LossRate_avg [probability 0..1] LossRate_rate [lost_pkts/sec]
224
       id->mhs[j] = monCreateMeasure(SEQWIN, PACKET | IN_BAND);
225
       start_measure(id->mhs[j++], 0, NULL, NULL, 0, id->addr, MSG_TYPE_CHUNK);
226
       id->mhs[j] = monCreateMeasure(LOSS, PACKET | IN_BAND);
227
       start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "LossRate", stwinavg, sizeof(stwinavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//LossRate_avg [probability 0..1] LossRate_rate [lost_pkts/sec]
216 228

  
217 229
       /* RX,TX volume in bytes (only chunks) */
218
       add_measure(&id->mhs[j++], RX_BYTE, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "RxBytesChunk", stsumwinsumrate, sizeof(stsumwinsumrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//[bytes]
219
       add_measure(&id->mhs[j++], TX_BYTE, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "TxBytesChunk", stsumwinsumrate, sizeof(stsumwinsumrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//[bytes]
230
       id->mhs[j] = monCreateMeasure(RX_BYTE, PACKET | IN_BAND);
231
       start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "RxBytesChunk", stsumwinsumrate, sizeof(stsumwinsumrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//[bytes]
232
       id->mhs[j] = monCreateMeasure(TX_BYTE, PACKET | IN_BAND);
233
       start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "TxBytesChunk", stsumwinsumrate, sizeof(stsumwinsumrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//[bytes]
220 234

  
221 235
       /* RX,TX volume in bytes (only signaling) */
222
       add_measure(&id->mhs[j++], RX_BYTE, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "RxBytesSig", stsumwinsumrate, sizeof(stsumwinsumrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[bytes]
223
       add_measure(&id->mhs[j++], TX_BYTE, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "TxBytesSig", stsumwinsumrate, sizeof(stsumwinsumrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[bytes]
236
       id->mhs[j] = monCreateMeasure(RX_BYTE, PACKET | IN_BAND);
237
       start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "RxBytesSig", stsumwinsumrate, sizeof(stsumwinsumrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[bytes]
238
       id->mhs[j] = monCreateMeasure(TX_BYTE, PACKET | IN_BAND);
239
       start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "TxBytesSig", stsumwinsumrate, sizeof(stsumwinsumrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[bytes]
224 240

  
225 241
	// Chunks
226
       add_measure(&id->mhs[j++], RX_PACKET, DATA | IN_BAND, P2P_PUBLISH_INTERVAL, "RxChunks", stwinavgrate, sizeof(stwinavgrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//RxChunks_sum [chunks] RxChunks_rate [chunks/sec]
227
       add_measure(&id->mhs[j++], TX_PACKET, DATA | IN_BAND, P2P_PUBLISH_INTERVAL, "TxChunks", stwinavgrate, sizeof(stwinavgrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//TxChunks_sum [chunks] TxChunks_rate [chunks/sec]
228
	add_measure(&id->mhs[j++], BULK_TRANSFER, PACKET | DATA | IN_BAND, P2P_PUBLISH_INTERVAL, "BulkTransfer", stwinavg, sizeof(stwinavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK); //Bulktransfer [bit/s]
242
       id->mhs[j] = monCreateMeasure(RX_PACKET, DATA | IN_BAND);
243
       start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "RxChunks", stwinavgrate, sizeof(stwinavgrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//RxChunks_sum [chunks] RxChunks_rate [chunks/sec]
244
       id->mhs[j] = monCreateMeasure(TX_PACKET, DATA | IN_BAND);
245
       start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "TxChunks", stwinavgrate, sizeof(stwinavgrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//TxChunks_sum [chunks] TxChunks_rate [chunks/sec]
246
       id->mhs[j] = monCreateMeasure(BULK_TRANSFER, PACKET | DATA | IN_BAND);
247
       start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "BulkTransfer", stwinavg, sizeof(stwinavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK); //Bulktransfer [bit/s]
248

  
229 249
//	// Capacity
230
	add_measure(&id->mhs[j++], CLOCKDRIFT, PACKET | IN_BAND, 0, NULL, NULL, 0, id->addr, MSG_TYPE_CHUNK);
231
	monSetParameter (id->mhs[j-1], P_CLOCKDRIFT_ALGORITHM, 1);
232
	add_measure(&id->mhs[j++], CORRECTED_DELAY, PACKET | IN_BAND, 0, NULL, NULL, 0, id->addr, MSG_TYPE_CHUNK);
233
	add_measure(&id->mhs[j++], CAPACITY_CAPPROBE, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "Capacity", stwinavg, sizeof(stwinavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//[bytes/s]
234
	monSetParameter (id->mhs[j-1], P_CAPPROBE_DELAY_TH, -1); //disable: seems to have  implementation problems
235
//	monSetParameter (id->mhs[j-1], P_CAPPROBE_PKT_TH, 5);
236
//	monSetParameter (mh, P_CAPPROBE_PKT_TH, 100);
237
//	monSetParameter (mh, P_CAPPROBE_IPD_TH, 60);
238
//	monPublishStatisticalType(mh, NULL, st , sizeof(st)/sizeof(enum stat_types), repoclient);
250
	id->mhs[j] = monCreateMeasure(CLOCKDRIFT, PACKET | IN_BAND);
251
	monSetParameter (id->mhs[j], P_CLOCKDRIFT_ALGORITHM, 1);
252
	start_measure(id->mhs[j++], 0, NULL, NULL, 0, id->addr, MSG_TYPE_CHUNK);
253
	id->mhs[j] = monCreateMeasure(CORRECTED_DELAY, PACKET | IN_BAND);
254
	start_measure(id->mhs[j++], 0, NULL, NULL, 0, id->addr, MSG_TYPE_CHUNK);
255
	id->mhs[j] = monCreateMeasure(CAPACITY_CAPPROBE, PACKET | IN_BAND);
256
	monSetParameter (id->mhs[j], P_CAPPROBE_DELAY_TH, -1);
257
//	monSetParameter (id->mhs[j], P_CAPPROBE_PKT_TH, 5);
258
	start_measure(id->mhs[j++], P2P_PUBLISH_INTERVAL, "Capacity", stwinavg, sizeof(stwinavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//[bytes/s]
239 259

  
240 260
	// for static must not be more then 10 or whatever size is in net_helper-ml.c
241 261
	id->n_mhs = j;

Also available in: Unified diff