EMANE  1.2.1
macstatistics.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 - Adjacent Link LLC, Bridgewater, New Jersey
3  * Copyright (c) 2008-2009 - DRS CenGen, LLC, Columbia, Maryland
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of DRS CenGen, LLC nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 
35 #include "macstatistics.h"
36 
43  id_{id},
44  pNumDownstreamUnicastDataDiscardDueToRetries_{},
45  pNumDownstreamUnicastRtsCtsDataDiscardDueToRetries_{},
46  pNumUpstreamUnicastDataDiscardDueToSinr_{},
47  pNumUpstreamBroadcastDataDiscardDueToSinr_{},
48  pNumUpstreamUnicastDataDiscardDueToClobberRxDuringTx_{},
49  pNumUpstreamBroadcastDataDiscardDueToClobberRxDuringTx_{},
50  pNumUpstreamUnicastDataDiscardDueToClobberRxHiddenBusy_{},
51  pNumUpstreamBroadcastDataDiscardDueToClobberRxHiddenBusy_{},
52  pNumDownstreamUnicastDataDiscardDueToTxop_{},
53  pNumDownstreamBroadcastDataDiscardDueToTxop_{},
54  pNumUpstreamUnicastRtsCtsDataRxFromPhy_{},
55  pNumUpstreamUnicastCtsRxFromPhy_{},
56  pNumUpstreamUnicastDataNoiseHiddenRx_{},
57  pNumUpstreamBroadcastDataNoiseHiddenRx_{},
58  pNumUpstreamUnicastDataNoiseRxCommon_{},
59  pNumUpstreamBroadcastDataNoiseRxCommon_{},
60  pNumOneHopNbrHighWaterMark_{},
61  pNumTwoHopNbrHighWaterMark_{},
62  pNumRxOneHopNbrListEvents_{},
63  pNumRxOneHopNbrListInvalidEvents_{},
64  pNumTxOneHopNbrListEvents_{}
65 {}
66 
67 
74 {}
75 
76 
78 {
79 
80  pNumDownstreamUnicastDataDiscardDueToRetries_ =
81  statisticRegistrar.registerNumeric<std::uint32_t>("numDownstreamUnicastDataDiscardDueToRetries",
83 
84  pNumDownstreamUnicastRtsCtsDataDiscardDueToRetries_ =
85  statisticRegistrar.registerNumeric<std::uint32_t>("numDownstreamUnicastRtsCtsDataDiscardDueToRetries",
87 
88  pNumUpstreamUnicastDataDiscardDueToSinr_ =
89  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamUnicastDataDiscardDueToSinr",
91  pNumUpstreamBroadcastDataDiscardDueToSinr_ =
92  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamBroadcastDataDiscardDueToSinr",
94 
95  pNumUpstreamUnicastDataDiscardDueToClobberRxDuringTx_ =
96  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamUnicastDataDiscardDueToClobberRxDuringTx",
98 
99  pNumUpstreamBroadcastDataDiscardDueToClobberRxDuringTx_ =
100  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamBroadcastDataDiscardDueToClobberRxDuringTx",
102 
103  pNumUpstreamUnicastDataDiscardDueToClobberRxHiddenBusy_ =
104  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamUnicastDataDiscardDueToClobberRxHiddenBusy",
106 
107  pNumUpstreamBroadcastDataDiscardDueToClobberRxHiddenBusy_ =
108  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamBroadcastDataDiscardDueToClobberRxHiddenBusy",
110  pNumDownstreamUnicastDataDiscardDueToTxop_ =
111  statisticRegistrar.registerNumeric<std::uint32_t>("numDownstreamUnicastDataDiscardDueToTxop",
113  pNumDownstreamBroadcastDataDiscardDueToTxop_ =
114  statisticRegistrar.registerNumeric<std::uint32_t>("numDownstreamBroadcastDataDiscardDueToTxop",
116 
117  pNumUpstreamUnicastDataNoiseHiddenRx_ =
118  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamUnicastDataNoiseHiddenRx",
120 
121  pNumUpstreamBroadcastDataNoiseHiddenRx_ =
122  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamBroadcastDataNoiseHiddenRx",
124 
125  pNumUpstreamUnicastDataNoiseRxCommon_ =
126  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamUnicastDataNoiseRxCommon",
128 
129  pNumUpstreamBroadcastDataNoiseRxCommon_ =
130  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamBroadcastDataNoiseRxCommon",
132 
133  pNumUpstreamUnicastRtsCtsDataRxFromPhy_ =
134  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamUnicastRtsCtsDataRxFromPhy",
136 
137  pNumUpstreamUnicastCtsRxFromPhy_ =
138  statisticRegistrar.registerNumeric<std::uint32_t>("numUpstreamUnicastRtsCtsRxFromPhy",
140 
141  pNumOneHopNbrHighWaterMark_ =
142  statisticRegistrar.registerNumeric<std::uint32_t>("numOneHopNbrHighWaterMark",
144 
145  pNumTwoHopNbrHighWaterMark_ =
146  statisticRegistrar.registerNumeric<std::uint32_t>("numTwoHopNbrHighWaterMark",
148 
149  pNumRxOneHopNbrListEvents_ =
150  statisticRegistrar.registerNumeric<std::uint32_t>("numRxOneHopNbrListEvents",
152  pNumRxOneHopNbrListInvalidEvents_ =
153  statisticRegistrar.registerNumeric<std::uint32_t>("numRxOneHopNbrListInvalidEvents",
155  pNumTxOneHopNbrListEvents_ =
156  statisticRegistrar.registerNumeric<std::uint32_t>("numTxOneHopNbrListEvents",
158 }
159 
160 
161 
167 void
169 {
170  // bump counter
171  ++*pNumUpstreamUnicastRtsCtsDataRxFromPhy_;
172 }
173 
174 
180 void
182 {
183  // bump counter
184  ++*pNumUpstreamUnicastCtsRxFromPhy_;
185 }
186 
187 
188 
194 void
196 {
197  // bump counter
198  ++*pNumDownstreamUnicastDataDiscardDueToRetries_;
199 }
200 
201 
207 void
209 {
210  // bump counter
211  ++*pNumDownstreamUnicastRtsCtsDataDiscardDueToRetries_;
212 }
213 
214 
215 
221 void
223 {
224  // bump counter
225  ++*pNumUpstreamUnicastDataDiscardDueToSinr_;
226 }
227 
228 
234 void
236 {
237  // bump counter
238  ++*pNumUpstreamBroadcastDataDiscardDueToSinr_;
239 }
240 
241 
247 void
249 {
250  // bump counter
251  ++*pNumUpstreamUnicastDataDiscardDueToClobberRxDuringTx_;
252 }
253 
254 
260 void
262 {
263  // bump counter
264  ++*pNumUpstreamBroadcastDataDiscardDueToClobberRxDuringTx_;
265 }
266 
267 
273 void
275 {
276  // bump counter
277  ++*pNumUpstreamUnicastDataDiscardDueToClobberRxHiddenBusy_;
278 }
279 
280 
286 void
288 {
289  // bump counter
290  ++*pNumUpstreamBroadcastDataDiscardDueToClobberRxHiddenBusy_;
291 }
292 
293 
294 
300 void
302 {
303  // bump counter
304  ++*pNumDownstreamUnicastDataDiscardDueToTxop_;
305 }
306 
307 
308 
314 void
316 {
317  // bump counter
318  ++*pNumDownstreamBroadcastDataDiscardDueToTxop_;
319 }
320 
321 
327 void
329 {
330  // bump counter
331  ++*pNumUpstreamUnicastDataNoiseHiddenRx_;
332 }
333 
334 
335 
341 void
343 {
344  // bump counter
345  ++*pNumUpstreamBroadcastDataNoiseHiddenRx_;
346 }
347 
348 
349 
355 void
357 {
358  // bump counter
359  ++*pNumUpstreamBroadcastDataNoiseRxCommon_;
360 }
361 
362 
368 void
370 {
371  // bump counter
372  ++*pNumUpstreamUnicastDataNoiseRxCommon_;
373 }
374 
375 
376 
382 void
384 {
385  if(*pNumOneHopNbrHighWaterMark_ < num)
386  {
387  *pNumOneHopNbrHighWaterMark_ = num;
388  }
389 }
390 
391 
392 
393 
399 void
401 {
402  if(*pNumTwoHopNbrHighWaterMark_ < num)
403  {
404  *pNumTwoHopNbrHighWaterMark_ = num;
405  }
406 }
407 
408 
414 void
416 {
417  // bump counter
418  ++*pNumRxOneHopNbrListEvents_;
419 }
420 
421 
427 void
429 {
430  // bump counter
431  ++*pNumRxOneHopNbrListInvalidEvents_;
432 }
433 
434 
435 
441 void
443 {
444  // bump counter
445  ++*pNumTxOneHopNbrListEvents_;
446 }
447 
void updateTwoHopNbrHighWaterMark(size_t num)
set the two hop nbr high water mark
void incrementUpstreamUnicastDataDiscardDueToSinr()
increment unicast data discard due to sinr
void incrementUpstreamBroadcastDataDiscardDueToSinr()
increment braodcast data discard due to sinr
void incrementRxOneHopNbrListEventCount()
increment number rx one hop nbr list events
MACStatistics(EMANE::NEMId)
constructor
void incrementTxOneHopNbrListEventCount()
increment number tx one hop nbr list events
void incrementUpstreamUnicastDataDiscardDueToClobberRxDuringTx()
increment unicast data discard due to collision rx during tx
void incrementUpstreamBroadcastNoiseHiddenRx()
increment braodcastcast data collision due to hidden rx
void incrementDownstreamUnicastRtsCtsDataDiscardDueToRetries()
increment braodcast data discard due to exhausted retries
The StatisticRegistrar allows NEM layers to register statistics and statistic tables. Statistics and Statistic tables are owned by the emulator framework and a borrowed reference is returned to the registering NEM layer.
void incrementUpstreamBroadcastNoiseRxCommon()
increment unicastcast data collision due to rx common
void updateOneHopNbrHighWaterMark(size_t num)
set the one hop nbr high water mark
void incrementUpstreamUnicastNoiseRxCommon()
increment braodcastcast data collision due to rx common
std::uint16_t NEMId
Definition: types.h:52
StatisticNumeric< T > * registerNumeric(const std::string &sName, const StatisticProperties &properties=StatisticProperties::NONE, const std::string &sDescription="")
void incrementDownstreamUnicastDataDiscardDueToRetries()
increment unicast data discard due to exhausted retries
void incrementUpstreamUnicastDataDiscardDueToClobberRxHiddenBusy()
increment unicast data discard due to collision rx busy hidden
void incrementUpstreamUnicastNoiseHiddenRx()
increment unicastcast data collision due to hidden rx
void registerStatistics(StatisticRegistrar &statisticRegistrar)
void incrementUpstreamBroadcastDataDiscardDueToClobberRxHiddenBusy()
increment braodcast data discard due to collision rx busy hidden
void incrementDownstreamUnicastDataDiscardDueToTxop()
increment unicast data discard due to txop expired
void incrementUpstreamUnicastCtsRxFromPhy()
increment unicast cts recv from phy
void incrementDownstreamBroadcastDataDiscardDueToTxop()
increment unicast data discard due to txop expired
void incrementRxOneHopNbrListInvalidEventCount()
increment number rx one hop nbr list invalid events
void incrementUpstreamBroadcastDataDiscardDueToClobberRxDuringTx()
increment braodcast data discard due to collision rx during tx
void incrementUpstreamUnicastRtsCtsDataRxFromPhy()
increment unicast rts/ctsdata recv from phy