Files
@ a407cd1b4167
Branch filter:
Location: Morevna/src/stats.py - annotation
a407cd1b4167
491 B
text/x-python
refactoring: removed obsolete files
41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c 41ea9614ce8c | class Stats:
received=0
sent=0
exchangedNodes=0
transferredBlocks=0
def logReceived(data):
Stats.received+=len(data)
def logSent(data):
Stats.sent+=len(data)
def logExchangedNode():
Stats.exchangedNodes+=1
def logTransferredBlock():
Stats.transferredBlocks+=1
def report():
return """received {r}B
sent {s}B
exchanged {nodes} hash tree nodes
transferred {blocks} blocks""".format(r=Stats.received, s=Stats.sent, nodes=Stats.exchangedNodes, blocks=Stats.transferredBlocks)
|