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("General | Value | \n")
out.write("Up time | " + str(elapsed) + ' | \n')
out.write("Reachable | " + str(self.reachable) + ' | \n')
out.write(" \n")
out.write('\n')
- out.write("\n")
# Routing
+ out.write("\n")
out.write("Routing Table | Value | \n")
out.write("Number of nodes | " + str(self.nodes) + ' | \n')
out.write("Total number of users | " + str(self.users) + ' | \n')
out.write(" \n")
out.write('\n')
- out.write("\n")
# Database
+ out.write("\n")
out.write("Database | Value | \n")
out.write("Keys | " + str(self.keys) + ' | \n')
out.write("Values | " + str(self.values) + ' | \n')
out.write(" \n")
out.write("\n")
+
+ # Transport
out.write("\n")
- out.write("Transport | Packets | Bytes | Bytes/second | \n")
+ out.write("Transport | Packets | Bytes | Speed | \n")
out.write("Downloaded | ")
out.write('' + str(self.downPackets) + ' | ')
- out.write('' + str(self.downBytes) + ' | ')
- out.write('%0.2f | \n' % (self.downBytes / (elapsed.days*86400.0 + elapsed.seconds), ))
+ out.write('' + byte_format(self.downBytes) + ' | ')
+ out.write('' + byte_format(self.downBytes / (elapsed.days*86400.0 + elapsed.seconds)) + '/sec | \n')
out.write("Uploaded | ")
out.write('' + str(self.upPackets) + ' | ')
- out.write('' + str(self.upBytes) + ' | ')
- out.write('%0.2f | \n' % (self.upBytes / (elapsed.days*86400.0 + elapsed.seconds), ))
+ out.write('' + byte_format(self.upBytes) + ' | ')
+ out.write('' + byte_format(self.upBytes / (elapsed.days*86400.0 + elapsed.seconds)) + '/sec | \n')
out.write(" \n")
out.write(" | \n")
- out.write("\n")
# Actions
+ out.write("\n")
out.write("Actions | Started | Sent | OK | Failed | Received | Error | \n")
actions = self.actions.keys()
actions.sort()
| | | |