X-Git-Url: https://git.mxchange.org/?p=quix0rs-apt-p2p.git;a=blobdiff_plain;f=apt_p2p_Khashmir%2Fstats.py;fp=apt_p2p_Khashmir%2Fstats.py;h=aee9bbbe5f72ab0b18c01ffc36e23eba758c3326;hp=5afc17ab077112c2c9748eadfe17d698dc0eba43;hb=d563aab35fc0fd1fab59e0f6d594fbb05735cf21;hpb=7a84d9fb17076695aba3c0f5a32c6487bdd3f059 diff --git a/apt_p2p_Khashmir/stats.py b/apt_p2p_Khashmir/stats.py index 5afc17a..aee9bbb 100644 --- a/apt_p2p_Khashmir/stats.py +++ b/apt_p2p_Khashmir/stats.py @@ -4,6 +4,8 @@ from datetime import datetime, timedelta from StringIO import StringIO +from util import byte_format + class StatsLogger: """Store the statistics for the Khashmir DHT. @@ -102,45 +104,47 @@ class StatsLogger: out.write('

DHT Statistics

\n') out.write("\n\n") out.write('
\n') - out.write("\n") # General + out.write("
\n") out.write("\n") out.write("\n') out.write("\n') out.write("

General

Value
Up time" + str(elapsed) + '
Reachable" + str(self.reachable) + '
\n") out.write('
\n') - out.write("\n") # Routing + out.write("
\n") out.write("\n") out.write("\n') out.write("\n') out.write("

Routing Table

Value
Number of nodes" + str(self.nodes) + '
Total number of users" + str(self.users) + '
\n") out.write('
\n') - out.write("\n") # Database + out.write("
\n") out.write("\n") out.write("\n') out.write("\n') out.write("

Database

Value
Keys" + str(self.keys) + '
Values" + str(self.values) + '
\n") out.write("
\n") + + # Transport out.write("\n") - out.write("\n") + out.write("\n") out.write("") out.write('') - out.write('') - out.write('\n' % (self.downBytes / (elapsed.days*86400.0 + elapsed.seconds), )) + out.write('') + out.write('\n') out.write("") out.write('') - out.write('') - out.write('\n' % (self.upBytes / (elapsed.days*86400.0 + elapsed.seconds), )) + out.write('') + out.write('\n') out.write("

Transport

PacketsBytesBytes/second

Transport

PacketsBytesSpeed
Downloaded' + str(self.downPackets) + '' + str(self.downBytes) + '%0.2f
' + byte_format(self.downBytes) + '' + byte_format(self.downBytes / (elapsed.days*86400.0 + elapsed.seconds)) + '/sec
Uploaded' + str(self.upPackets) + '' + str(self.upBytes) + '%0.2f
' + byte_format(self.upBytes) + '' + byte_format(self.upBytes / (elapsed.days*86400.0 + elapsed.seconds)) + '/sec
\n") out.write("
\n") - out.write("\n") # Actions + out.write("
\n") out.write("\n") actions = self.actions.keys() actions.sort()

Actions

StartedSentOKFailedReceivedError