Files
@ 6355fe7d655f
Branch filter:
Location: Morevna/src/stats.py - annotation
6355fe7d655f
491 B
text/x-python
fix server hash tree update for real
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)
|