Revision 45395cd8 measures-monl.c

View differences:

measures-monl.c
56 56
{
57 57
	if (!chunk_dup) {
58 58
		enum stat_types st[] = {SUM, RATE};
59
		// number of chunks which have been received more then once
59 60
		add_measure(&chunk_dup, GENERIC, 0, PEER_PUBLISH_INTERVAL, "ChunkDuplicates", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[chunks]
60 61
		monNewSample(chunk_dup, 0);	//force publish even if there are no events
61 62
	}
......
71 72
	static int last_arrived_chunk = -1;
72 73

  
73 74
	struct timeval tnow;
74

  
75 75
	if (!chunk_playout && b) {	//don't count losses before the first arrived chunk
76 76
		enum stat_types st[] = {WIN_AVG, AVG, SUM, RATE};
77
		//number of chunks played
77 78
		add_measure(&chunk_playout, GENERIC, 0, PEER_PUBLISH_INTERVAL, "ChunksPlayed", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[chunks]
78 79
	}
79 80
	monNewSample(chunk_playout, b);
80 81

  
81 82
	if (!playout_delay) {
82 83
		enum stat_types st[] = {WIN_AVG, WIN_VAR};
83
		add_measure(&playout_delay, GENERIC, 0, PEER_PUBLISH_INTERVAL, "ReorderDelay", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[peers]
84
		//delay after reorder buffer, however http module does not use reorder buffer
85
		add_measure(&playout_delay, GENERIC, 0, PEER_PUBLISH_INTERVAL, "ReorderDelay", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[seconds]
84 86
	}
85 87
	if (b) {	//count delay only if chunk has arrived
86 88
		gettimeofday(&tnow, NULL);
......
89 91

  
90 92
	//if (!chunk_loss_burst_size) {
91 93
	//	enum stat_types st[] = {WIN_AVG, WIN_VAR};
92
	//	add_measure(&chunk_loss_burst_size, GENERIC, 0, PEER_PUBLISH_INTERVAL, "ChunkLossBurstSize", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[peers]
94
	//	// number of consecutive lost chunks
95
	//	add_measure(&chunk_loss_burst_size, GENERIC, 0, PEER_PUBLISH_INTERVAL, "ChunkLossBurstSize", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[chunks]
93 96
	//}
94 97
	if (b) {
95 98
		if (last_arrived_chunk >= 0) {
......
107 110
{
108 111
	if (!neigh_size) {
109 112
		enum stat_types st[] = {LAST};
113
		// number of peers in the neighboorhood
110 114
		add_measure(&neigh_size, GENERIC, 0, PEER_PUBLISH_INTERVAL, "NeighSize", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[peers]
111 115
	}
112 116
	monNewSample(neigh_size, s);
......
121 125

  
122 126
	if (!chunk_receive) {
123 127
		enum stat_types st[] = {RATE};
124
		add_measure(&chunk_receive, GENERIC, 0, PEER_PUBLISH_INTERVAL, "RxChunkAll", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[peers]
128
		// total number of received chunks per second
129
		add_measure(&chunk_receive, GENERIC, 0, PEER_PUBLISH_INTERVAL, "TotalRxChunk", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[chunks/s]
125 130
		monNewSample(chunk_receive, 0);	//force publish even if there are no events
126 131
	}
127 132
	monNewSample(chunk_receive, 1);
128 133

  
129 134
	if (!chunk_hops) {
130
		enum stat_types st[] = {WIN_AVG, WIN_VAR};
131
		add_measure(&chunk_hops, GENERIC, 0, PEER_PUBLISH_INTERVAL, "Hops", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[peers]
135
		enum stat_types st[] = {WIN_AVG};
136
		// number of hops from source on the p2p network
137
		add_measure(&chunk_hops, GENERIC, 0, PEER_PUBLISH_INTERVAL, "OverlayHops", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[peers]
132 138
	}
133 139
	monNewSample(chunk_hops, hopcount);
134 140

  
135 141
	if (!chunk_delay) {
136 142
		enum stat_types st[] = {WIN_AVG, WIN_VAR};
137
		add_measure(&chunk_delay, GENERIC, 0, PEER_PUBLISH_INTERVAL, "ReceiveDelay", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[peers]
143
		// time elapsed since the source emitted the chunk
144
		add_measure(&chunk_delay, GENERIC, 0, PEER_PUBLISH_INTERVAL, "ReceiveDelay", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[seconds]
138 145
	}
139 146
	gettimeofday(&tnow, NULL);
140 147
	monNewSample(chunk_delay, ((int64_t)(tnow.tv_usec + tnow.tv_sec * 1000000ULL) - (int64_t)timestamp) / 1000000.0);
......
147 154
{
148 155
	if (!chunk_send) {
149 156
		enum stat_types st[] = {RATE};
150
		add_measure(&chunk_send, GENERIC, 0, PEER_PUBLISH_INTERVAL, "TxChunkAll", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[peers]
157
		add_measure(&chunk_send, GENERIC, 0, PEER_PUBLISH_INTERVAL, "TotalTxChunk", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[chunks/s]
151 158
		monNewSample(chunk_send, 0);	//force publish even if there are no events
152 159
	}
153 160
	monNewSample(chunk_send, 1);
......
159 166
void reg_offer_accept(bool b)
160 167
{
161 168
	if (!offer_accept) {
162
		enum stat_types st[] = {AVG};
163
		add_measure(&offer_accept, GENERIC, 0, PEER_PUBLISH_INTERVAL, "OfferAccept", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[peers]
169
		enum stat_types st[] = {WIN_AVG};
170
		// ratio between number of offers and number of accepts
171
		add_measure(&offer_accept, GENERIC, 0, PEER_PUBLISH_INTERVAL, "OfferAccept", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);	//[no unit -> ratio]
164 172
	}
165 173
	monNewSample(offer_accept, b);
166 174
}
......
170 178
*/
171 179
void init_measures()
172 180
{
173
	//enum stat_types stavg[] = {WIN_AVG};
174
	//enum stat_types stsum[] = {SUM};
175

  
176 181
	if (peername) monSetPeerName(peername);
177

  
178
	// Traffic
179
       //add_measure(&rx_bytes_chunk_per_sec, BULK_TRANSFER, RXONLY | PACKET | TIMER_BASED, PEER_PUBLISH_INTERVAL, "RxBytesChunkPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), NULL, MSG_TYPE_CHUNK);	//[bytes/s]
180
       //add_measure(&tx_bytes_chunk_per_sec, BULK_TRANSFER, TXONLY | PACKET | TIMER_BASED, PEER_PUBLISH_INTERVAL, "TxBytesChunkPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), NULL, MSG_TYPE_CHUNK);	//[bytes/s]
181
       //add_measure(&rx_bytes_sig_per_sec, BULK_TRANSFER, RXONLY | PACKET | TIMER_BASED, PEER_PUBLISH_INTERVAL, "RxBytesSigPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), NULL, MSG_TYPE_SIGNALLING);	//[bytes/s]
182
       //add_measure(&tx_bytes_sig_per_sec, BULK_TRANSFER, TXONLY | PACKET | TIMER_BASED, PEER_PUBLISH_INTERVAL, "TxBytesSigPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), NULL, MSG_TYPE_SIGNALLING);	//[bytes/s]
183

  
184
	// Chunks
185
       // replaced by reg_chun_receive add_measure(&rx_chunks, COUNTER, RXONLY | DATA | IN_BAND, PEER_PUBLISH_INTERVAL, "RxChunksAll", stsum, sizeof(stsum)/sizeof(enum stat_types), NULL, MSG_TYPE_CHUNK);	//[chunks]
186
       // replaced by reg_chun_send add_measure(&tx_chunks, COUNTER, TXONLY | DATA | IN_BAND, PEER_PUBLISH_INTERVAL, "TxChunksAll", stsum, sizeof(stsum)/sizeof(enum stat_types), NULL, MSG_TYPE_CHUNK);	//[chunks]
187 182
}
188 183

  
189 184
/*
......
200 195
{
201 196
	// Add measures
202 197
	int j = 0;
203
	enum stat_types stavg[] = {AVG};
198
	enum stat_types stwinavgwinvar[] = {WIN_AVG, WIN_VAR};
204 199
	enum stat_types stwinavg[] = {WIN_AVG};
200
	enum stat_types stwinavgrate[] = {WIN_AVG, RATE};
205 201
	enum stat_types stsum[] = {SUM};
206
	enum stat_types stsumrate[] = {SUM, RATE};
202
	enum stat_types stsumwinsumrate[] = {SUM, WIN_SUM, RATE};
207 203

  
208 204
	dprintf("adding measures to %s\n",node_addr(id));
209 205

  
210 206
	/* HopCount */
207
	// number of hops at IP level
211 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]
212 209

  
213 210
	/* Round Trip Time */
214
       add_measure(&id->mhs[j++], RTT, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "RoundTripDelay", stwinavg, sizeof(stwinavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[seconds]
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]
215 212

  
216 213
	/* Loss */
217 214
       add_measure(&id->mhs[j++], SEQWIN, PACKET | IN_BAND, 0, NULL, NULL, 0, id->addr, MSG_TYPE_CHUNK);
218 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]
219 216

  
220
	// Cumulative Traffic
221
       //add_measure(&id->mhs[j++], BYTE, RXONLY | PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "RxBytes", stsum, sizeof(stsum)/sizeof(enum stat_types), id->addr, MSG_TYPE_ANY);
222
       //add_measure(&id->mhs[j++], BYTE, TXONLY | PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "TxBytes", stsum, sizeof(stsum)/sizeof(enum stat_types), id->addr, MSG_TYPE_ANY);
223
       add_measure(&id->mhs[j++], RX_BYTE, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "RxBytesChunk", stsum, sizeof(stsum)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//[bytes]
224
       add_measure(&id->mhs[j++], TX_BYTE, PACKET | IN_BAND, P2P_PUBLISH_INTERVAL, "TxBytesChunk", stsum, sizeof(stsum)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//[bytes]
217
       /* 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]
225 220

  
226
	// Traffic
227
       add_measure(&id->mhs[j++], RX_BULK_TRANSFER, PACKET | TIMER_BASED, P2P_PUBLISH_INTERVAL, "RxBytesChunkPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//[bytes/s]
228
       add_measure(&id->mhs[j++], TX_BULK_TRANSFER, PACKET | TIMER_BASED, P2P_PUBLISH_INTERVAL, "TxBytesChunkPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//[bytes/s]
229
       add_measure(&id->mhs[j++], RX_BULK_TRANSFER, PACKET | TIMER_BASED, P2P_PUBLISH_INTERVAL, "RxBytesSigPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[bytes/s]
230
       add_measure(&id->mhs[j++], TX_BULK_TRANSFER, PACKET | TIMER_BASED, P2P_PUBLISH_INTERVAL, "TxBytesSigPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);	//[bytes/s]
221
       /* 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]
231 224

  
232 225
	// Chunks
233
       add_measure(&id->mhs[j++], RX_PACKET, DATA | IN_BAND, P2P_PUBLISH_INTERVAL, "RxChunks", stsumrate, sizeof(stsumrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//RxChunks_sum [chunks] RxChunks_rate [chunks/sec]
234
       add_measure(&id->mhs[j++], TX_PACKET, DATA | IN_BAND, P2P_PUBLISH_INTERVAL, "TxChunks", stsumrate, sizeof(stsumrate)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);	//TxChunks_sum [chunks] TxChunks_rate [chunks/sec]
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]
235 228
//	// Capacity
236 229
//	add_measure(&id->mhs[j++], CLOCKDRIFT, PACKET | IN_BAND, 0, NULL, NULL, 0, id->addr, MSG_TYPE_CHUNK);
237 230
//	monSetParameter (id->mhs[j], P_CLOCKDRIFT_ALGORITHM, 1);

Also available in: Unified diff