mirror of
https://github.com/status-im/das-research.git
synced 2025-02-22 19:38:14 +00:00
add tx/rx troughput statistics
Collect statistics about Tx/Rx troughput, per timeslot and per node. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
ad11214e2d
commit
6c6e10b81f
@ -111,6 +111,8 @@ class Simulator:
|
||||
self.validators[i].sendColumns()
|
||||
self.validators[i].logRows()
|
||||
self.validators[i].logColumns()
|
||||
for i in range(0,self.numberValidators):
|
||||
self.validators[i].updateStats()
|
||||
|
||||
arrived, expected = self.glob.checkStatus(self.validators)
|
||||
missingSamples = expected - arrived
|
||||
|
@ -57,6 +57,12 @@ class Validator:
|
||||
self.rowNeighbors = collections.defaultdict(dict)
|
||||
self.columnNeighbors = collections.defaultdict(dict)
|
||||
|
||||
#statistics
|
||||
self.statsTxInSlot = 0
|
||||
self.statsTxPerSlot = []
|
||||
self.statsRxInSlot = 0
|
||||
self.statsRxPerSlot = []
|
||||
|
||||
def logIDs(self):
|
||||
if self.amIproposer == 1:
|
||||
self.logger.warning("I am a block proposer."% self.ID)
|
||||
@ -103,6 +109,7 @@ class Validator:
|
||||
# register receive so that we are not sending back
|
||||
self.columnNeighbors[id][src].received |= column
|
||||
self.receivedBlock.mergeColumn(id, column)
|
||||
self.statsRxInSlot += column.count(1)
|
||||
else:
|
||||
pass
|
||||
|
||||
@ -111,6 +118,7 @@ class Validator:
|
||||
# register receive so that we are not sending back
|
||||
self.rowNeighbors[id][src].received |= row
|
||||
self.receivedBlock.mergeRow(id, row)
|
||||
self.statsRxInSlot += row.count(1)
|
||||
else:
|
||||
pass
|
||||
|
||||
@ -134,6 +142,14 @@ class Validator:
|
||||
|
||||
self.block.merge(self.receivedBlock)
|
||||
|
||||
def updateStats(self):
|
||||
self.logger.debug("Stats: tx %d, rx %d", self.statsTxInSlot, self.statsRxInSlot, extra=self.format)
|
||||
self.statsRxPerSlot.append(self.statsRxInSlot)
|
||||
self.statsTxPerSlot.append(self.statsTxInSlot)
|
||||
self.statsRxInSlot = 0
|
||||
self.statsTxInSlot = 0
|
||||
|
||||
|
||||
def sendColumn(self, columnID):
|
||||
line = self.getColumn(columnID)
|
||||
if line.any():
|
||||
@ -145,6 +161,7 @@ class Validator:
|
||||
if (toSend).any():
|
||||
n.sent |= toSend;
|
||||
n.node.receiveColumn(columnID, toSend, self.ID)
|
||||
self.statsTxInSlot += toSend.count(1)
|
||||
|
||||
def sendRow(self, rowID):
|
||||
line = self.getRow(rowID)
|
||||
@ -157,6 +174,7 @@ class Validator:
|
||||
if (toSend).any():
|
||||
n.sent |= toSend;
|
||||
n.node.receiveRow(rowID, toSend, self.ID)
|
||||
self.statsTxInSlot += toSend.count(1)
|
||||
|
||||
def sendRows(self):
|
||||
if self.amIproposer == 1:
|
||||
|
Loading…
x
Reference in New Issue
Block a user