add duplicate statistics
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
6616cc799f
commit
7e4074938a
|
@ -70,11 +70,14 @@ class Observer:
|
|||
def getTrafficStats(self, validators):
|
||||
statsTxInSlot = [v.statsTxInSlot for v in validators]
|
||||
statsRxInSlot = [v.statsRxInSlot for v in validators]
|
||||
statsRxDupInSlot = [v.statsRxDupInSlot for v in validators]
|
||||
TX_prod = statsTxInSlot[0]
|
||||
RX_prod = statsRxInSlot[0]
|
||||
TX_avg = mean(statsTxInSlot[1:])
|
||||
TX_max = max(statsTxInSlot[1:])
|
||||
Rx_avg = mean(statsRxInSlot[1:])
|
||||
Rx_max = max(statsRxInSlot[1:])
|
||||
RxDup_avg = mean(statsRxDupInSlot[1:])
|
||||
RxDup_max = max(statsRxDupInSlot[1:])
|
||||
|
||||
return (TX_prod, RX_prod, TX_avg, TX_max, Rx_avg, Rx_max)
|
||||
return (TX_prod, RX_prod, TX_avg, TX_max, Rx_avg, Rx_max, RxDup_avg, RxDup_max)
|
||||
|
|
|
@ -188,9 +188,9 @@ class Simulator:
|
|||
self.validators[i].logColumns()
|
||||
|
||||
# log TX and RX statistics
|
||||
TX_prod, RX_prod, TX_avg, TX_max, Rx_avg, Rx_max = self.glob.getTrafficStats(self.validators)
|
||||
self.logger.debug("step %d: TX_prod=%.1f, RX_prod=%.1f, TX_avg=%.1f, TX_max=%.1f, Rx_avg=%.1f, Rx_max=%.1f" %
|
||||
(steps, TX_prod, RX_prod, TX_avg, TX_max, Rx_avg, Rx_max), extra=self.format)
|
||||
TX_prod, RX_prod, TX_avg, TX_max, Rx_avg, Rx_max, RxDup_avg, RxDup_max = self.glob.getTrafficStats(self.validators)
|
||||
self.logger.info("step %d: TX_prod=%.1f, RX_prod=%.1f, TX_avg=%.1f, TX_max=%.1f, Rx_avg=%.1f, Rx_max=%.1f, RxDup_avg=%.1f, RxDup_max=%.1f" %
|
||||
(steps, TX_prod, RX_prod, TX_avg, TX_max, Rx_avg, Rx_max ,RxDup_avg, RxDup_max), extra=self.format)
|
||||
for i in range(0,self.shape.numberNodes):
|
||||
self.validators[i].updateStats()
|
||||
|
||||
|
|
|
@ -79,6 +79,8 @@ class Validator:
|
|||
self.statsTxPerSlot = []
|
||||
self.statsRxInSlot = 0
|
||||
self.statsRxPerSlot = []
|
||||
self.statsRxDupInSlot = 0
|
||||
self.statsRxDupPerSlot = []
|
||||
|
||||
# Set uplink bandwidth. In segments (~560 bytes) per timestep (50ms?)
|
||||
# 1 Mbps ~= 1e6 / 20 / 8 / 560 ~= 11
|
||||
|
@ -163,7 +165,7 @@ class Validator:
|
|||
self.receivedQueue.append((rID, cID))
|
||||
else:
|
||||
self.logger.trace("Recv DUP: %d->%d: %d,%d", src, self.ID, rID, cID, extra=self.format)
|
||||
# self.statsRxDuplicateInSlot += 1
|
||||
self.statsRxDupInSlot += 1
|
||||
self.statsRxInSlot += 1
|
||||
|
||||
def addToSendQueue(self, rID, cID):
|
||||
|
@ -205,8 +207,10 @@ class Validator:
|
|||
"""It updates the stats related to sent and received data."""
|
||||
self.logger.debug("Stats: tx %d, rx %d", self.statsTxInSlot, self.statsRxInSlot, extra=self.format)
|
||||
self.statsRxPerSlot.append(self.statsRxInSlot)
|
||||
self.statsRxDupPerSlot.append(self.statsRxDupInSlot)
|
||||
self.statsTxPerSlot.append(self.statsTxInSlot)
|
||||
self.statsRxInSlot = 0
|
||||
self.statsRxDupInSlot = 0
|
||||
self.statsTxInSlot = 0
|
||||
|
||||
def checkSegmentToNeigh(self, rID, cID, neigh):
|
||||
|
|
Loading…
Reference in New Issue