"""
from datetime import datetime
-from StringIO import StringIO
import os, sha, random
from twisted.internet import defer, reactor
def getStats(self):
"""See L{apt_p2p.interfaces.IDHTStats}."""
- stats = self.khashmir.getStats()
- out = StringIO()
- out.write('<h2>DHT Statistics</h2>\n')
- old_group = None
- for stat in stats:
- if stat['group'] != old_group:
- if old_group is not None:
- out.write('</table>\n')
- out.write('\n<h3>' + stat['group'] + '</h3>\n')
- out.write("<table border='1'>\n")
- if stat['group'] != 'Actions':
- out.write("<tr><th>Statistic</th><th>Value</th></tr>\n")
- else:
- out.write("<tr><th>Action</th><th>Started</th><th>Sent</th><th>OK</th><th>Failed</th><th>Received</th><th>Error</th></tr>\n")
- old_group = stat['group']
- if stat['group'] != 'Actions':
- out.write("<tr title='" + stat['tip'] + "'><td>" + stat['desc'] + '</td><td>' + str(stat['value']) + '</td></tr>\n')
- else:
- actions = stat['value'].keys()
- actions.sort()
- for action in actions:
- out.write("<tr><td>" + action + "</td>")
- for i in xrange(6):
- out.write("<td>" + str(stat['value'][action][i]) + "</td>")
- out.write('</tr>\n')
-
- return out.getvalue()
+ return self.khashmir.getStats()
def getStatsFactory(self):
"""See L{apt_p2p.interfaces.IDHTStatsFactory}."""