Revision a5c0b447

View differences:

measures.c
17 17

  
18 18
static MonHandler chunk_dup, chunk_playout, neigh_size;
19 19

  
20
void add_measure(MonHandler *mh, MeasurementId id, MeasurementCapabilities mc, MonParameterValue rate, const char *pubname, enum stat_types st[], int length, SocketId dst, MsgType mt)
21
{
22
	*mh = monCreateMeasure(id, mc);
23
	monSetParameter (*mh, P_PUBLISHING_RATE, rate);
24
	monPublishStatisticalType(*mh, pubname, channel, st , length, NULL);
25
	monActivateMeasure(*mh, dst, mt);
26
}
27

  
20 28
void reg_chunk_duplicate()
21 29
{
22 30
	if (!chunk_dup) {
23 31
		enum stat_types st[] = {SUM};
24
		chunk_dup = monCreateMeasure(GENERIC, 0);
25
		monSetParameter (chunk_dup, P_PUBLISHING_RATE, 120);
26
		monPublishStatisticalType(chunk_dup, "ChunkDuplicates", channel, st , sizeof(st)/sizeof(enum stat_types), NULL);
27
		monActivateMeasure(chunk_dup, NULL, MSG_TYPE_ANY);
32
		add_measure(&chunk_dup, GENERIC, 0, 120, "ChunkDuplicates", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);
28 33
	}
29 34
	monNewSample(chunk_dup, 1);
30 35
}
......
33 38
{
34 39
	if (!chunk_playout) {
35 40
		enum stat_types st[] = {AVG, SUM};
36
		chunk_playout = monCreateMeasure(GENERIC, 0);
37
		monSetParameter (chunk_playout, P_PUBLISHING_RATE, 120);
38
		monPublishStatisticalType(chunk_playout, "ChunksPlayed", channel, st , sizeof(st)/sizeof(enum stat_types), NULL);
39
		monActivateMeasure(chunk_playout, NULL, MSG_TYPE_ANY);
41
		add_measure(&chunk_playout, GENERIC, 0, 120, "ChunksPlayed", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);
40 42
	}
41 43
	monNewSample(chunk_playout, b);
42 44
}
......
45 47
{
46 48
	if (!neigh_size) {
47 49
		enum stat_types st[] = {LAST};
48
		neigh_size = monCreateMeasure(GENERIC, 0);
49
		monSetParameter (neigh_size, P_PUBLISHING_RATE, 120);
50
		monPublishStatisticalType(neigh_size, "NeighSize", channel, st , sizeof(st)/sizeof(enum stat_types), NULL);
51
		monActivateMeasure(neigh_size, NULL, MSG_TYPE_ANY);
50
		add_measure(&neigh_size, GENERIC, 0, 120, "NeighSize", st, sizeof(st)/sizeof(enum stat_types), NULL, MSG_TYPE_ANY);
52 51
	}
53 52
	monNewSample(neigh_size, s);
54 53
}
......
63 62
	dprintf("adding measures to %s\n",node_addr(id));
64 63

  
65 64
	/* HopCount */
66
	id->mhs[j] = monCreateMeasure(HOPCOUNT, TXRXUNI | PACKET | IN_BAND);
67
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 600);
68
	//Uncomment the following line to publish results
69
	monPublishStatisticalType(id->mhs[j], NULL, channel, stavg , sizeof(stavg)/sizeof(enum stat_types), NULL);
70
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_CHUNK);
71
	j++;
65
       add_measure(&id->mhs[j++], HOPCOUNT, TXRXUNI | PACKET | IN_BAND, 600, "HopCount", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);
72 66

  
73 67
	/* Round Trip Time */
74
	id->mhs[j] = monCreateMeasure(RTT, TXRXBI | PACKET | IN_BAND);
75
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 60);
76
	//Uncomment the following line to publish results
77
	monPublishStatisticalType(id->mhs[j], "RoundTripDelay", channel, stavg , sizeof(stavg)/sizeof(enum stat_types), NULL);
78
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_SIGNALLING);
79
	j++;
68
       add_measure(&id->mhs[j++], RTT, TXRXBI | PACKET | IN_BAND, 60, "RoundTripDelay", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);
80 69

  
81 70
	/* Loss */
82
	id->mhs[j] = monCreateMeasure(LOSS, TXRXUNI | PACKET | IN_BAND);
83
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 60);
84
	//Uncomment the following line to publish results
85
	monPublishStatisticalType(id->mhs[j], NULL, channel, stavg , sizeof(stavg)/sizeof(enum stat_types), NULL);
86
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_CHUNK);
87
	j++;
88

  
89
	// RX bytes
90
//	id->mhs[j] = monCreateMeasure(BYTE, RXONLY | PACKET | IN_BAND);
91
//	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 120);
92
	//Uncomment the following line to publish results
93
//	monPublishStatisticalType(id->mhs[j], "RxBytes", channel, stsum , sizeof(stsum)/sizeof(enum stat_types), NULL);
94
//	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_ANY);
95
//	j++;
96

  
97
	// TX bytes
98
//	id->mhs[j] = monCreateMeasure(BYTE, TXONLY | PACKET | IN_BAND);
99
//	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 120);
100
	//Uncomment the following line to publish results
101
//	monPublishStatisticalType(id->mhs[j], "TxBytes", channel, stsum , sizeof(stsum)/sizeof(enum stat_types), NULL);
102
//	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_ANY);
103
//	j++;
104

  
105
	// RX bytes
106
	id->mhs[j] = monCreateMeasure(BYTE, RXONLY | PACKET | IN_BAND);
107
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 600);
108
	//Uncomment the following line to publish results
109
	monPublishStatisticalType(id->mhs[j], "RxBytesChunk", channel, stsum , sizeof(stsum)/sizeof(enum stat_types), NULL);
110
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_CHUNK);
111
	j++;
112

  
113
	// TX bytes
114
	id->mhs[j] = monCreateMeasure(BYTE, TXONLY | PACKET | IN_BAND);
115
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 600);
116
	//Uncomment the following line to publish results
117
	monPublishStatisticalType(id->mhs[j], "TxBytesChunk", channel, stsum , sizeof(stsum)/sizeof(enum stat_types), NULL);
118
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_CHUNK);
119
	j++;
120

  
121
	id->mhs[j] = monCreateMeasure(BULK_TRANSFER, RXONLY | PACKET | TIMER_BASED);
122
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 600);
123
	//Uncomment the following line to publish results
124
	monPublishStatisticalType(id->mhs[j], "RxChunkSec", channel, stavg , sizeof(stavg)/sizeof(enum stat_types), NULL);
125
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_CHUNK);
126
        j++;
127

  
128
	id->mhs[j] = monCreateMeasure(BULK_TRANSFER, TXONLY | PACKET | TIMER_BASED);
129
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 600);
130
	//Uncomment the following line to publish results
131
	monPublishStatisticalType(id->mhs[j], "TxChunkSec", channel, stavg , sizeof(stavg)/sizeof(enum stat_types), NULL);
132
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_CHUNK);
133
        j++;
134

  
135
	id->mhs[j] = monCreateMeasure(BULK_TRANSFER, RXONLY | PACKET | TIMER_BASED);
136
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 600);
137
	//Uncomment the following line to publish results
138
	monPublishStatisticalType(id->mhs[j], "RxSigSec", channel, stavg , sizeof(stavg)/sizeof(enum stat_types), NULL);
139
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_SIGNALLING);
140
        j++;
141

  
142
	id->mhs[j] = monCreateMeasure(BULK_TRANSFER, TXONLY | PACKET | TIMER_BASED);
143
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 600);
144
	//Uncomment the following line to publish results
145
	monPublishStatisticalType(id->mhs[j], "TxSigSec", channel, stavg , sizeof(stavg)/sizeof(enum stat_types), NULL);
146
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_SIGNALLING);
147
        j++;
148

  
149
	id->mhs[j] = monCreateMeasure(COUNTER, RXONLY | DATA);
150
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 600);
151
	//Uncomment the following line to publish results
152
	monPublishStatisticalType(id->mhs[j], "RxChunks", channel, stsum , sizeof(stsum)/sizeof(enum stat_types), NULL);
153
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_CHUNK);
154
        j++;
155

  
156
	id->mhs[j] = monCreateMeasure(COUNTER, TXONLY | DATA);
157
	monSetParameter (id->mhs[j], P_PUBLISHING_RATE, 600);
158
	//Uncomment the following line to publish results
159
	monPublishStatisticalType(id->mhs[j], "TxChunks", channel, stsum , sizeof(stsum)/sizeof(enum stat_types), NULL);
160
	monActivateMeasure(id->mhs[j], id->addr, MSG_TYPE_CHUNK);
161
        j++;
71
       add_measure(&id->mhs[j++], LOSS, TXRXUNI | PACKET | IN_BAND, 60, "LossRate", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);
72

  
73
	// Cumulative Traffic
74
       //add_measure(&id->mhs[j++], BYTE, RXONLY | PACKET | IN_BAND, 120, "RxBytes", stsum, sizeof(stsum)/sizeof(enum stat_types), id->addr, MSG_TYPE_ANY);
75
       //add_measure(&id->mhs[j++], BYTE, TXONLY | PACKET | IN_BAND, 120, "TxBytes", stsum, sizeof(stsum)/sizeof(enum stat_types), id->addr, MSG_TYPE_ANY);
76
       add_measure(&id->mhs[j++], BYTE, RXONLY | PACKET | IN_BAND, 120, "RxBytesChunk", stsum, sizeof(stsum)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);
77
       add_measure(&id->mhs[j++], BYTE, TXONLY | PACKET | IN_BAND, 120, "TxBytesChunk", stsum, sizeof(stsum)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);
78

  
79
	// Traffic
80
       add_measure(&id->mhs[j++], BULK_TRANSFER, RXONLY | PACKET | TIMER_BASED, 120, "RxBytesChunkPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);
81
       add_measure(&id->mhs[j++], BULK_TRANSFER, TXONLY | PACKET | TIMER_BASED, 120, "TxBytesChunkPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);
82
       add_measure(&id->mhs[j++], BULK_TRANSFER, RXONLY | PACKET | TIMER_BASED, 120, "RxBytesSigPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);
83
       add_measure(&id->mhs[j++], BULK_TRANSFER, TXONLY | PACKET | TIMER_BASED, 120, "TxBytesSigPSec", stavg, sizeof(stavg)/sizeof(enum stat_types), id->addr, MSG_TYPE_SIGNALLING);
84

  
85
	// Chunks
86
       add_measure(&id->mhs[j++], COUNTER, RXONLY | DATA | IN_BAND, 120, "RxChunks", stsum, sizeof(stsum)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);
87
       add_measure(&id->mhs[j++], COUNTER, TXONLY | DATA | IN_BAND, 120, "TxChunks", stsum, sizeof(stsum)/sizeof(enum stat_types), id->addr, MSG_TYPE_CHUNK);
162 88

  
163 89
	// for static must not be more then 10 or whatever size is in net_helper-ml.c
164 90
	id->n_mhs = j;

Also available in: Unified diff