restrictions.append(('direction', '1', 'eq'))
if self.options[3]:
+ if self.options[4]:
+ restrictions.append(('peer_port', self.options[4], 'eq'))
restrictions.append(('peer_ip', self.options[3], 'eq'))
vbmc = VerboseMessageCollection(self.dbname, self.cs_id, restrictions)
upload_speed = Bool()
acceleration = Bool()
stats = Bool()
- direction = Enum("Both", "In", "Out")
+ direction = Enum("In/Out", "In", "Out")
ip = Str()
+ port = Str()
plot = Button()
Item('57'),
Item('stats', label="Statistics")),
HGroup(
- Item('direction'),
- Item('28'),
- Item('ip', label="Peer IP"), enabled_when='object.stats'),
+ #HGroup(
+ Item('ip', label="Peer IP"),
+ Item('port', show_label=False),
+ Item('direction', show_label=False),
+ #Item('28'),
+ enabled_when='object.stats'),
show_border=True, label='Plotting Options'),
Item('10'),
Item('plot', show_label=False),
self.figure.subplots_adjust(left=0.03, right=0.97, top=0.98)
PlotterThread(dbfile, self.cs_id, 0, self.plot_figure, options, 1).start()
else:
- options2 = [self.time_start, self.time_stop, self.direction, self.ip]
+ options2 = [self.time_start, self.time_stop, self.direction, self.ip, self.port]
axes = self.figure.add_subplot(2,1,2)
axes.grid(linestyle='dashed')
axes = self.figure.add_subplot(2,2,1)
+++ /dev/null
-import sys
-import getopt
-import julian
-import matplotlib.pyplot as plt
-from config import *
-from DbObjects import *
-import numpy as np
-
-def main():
- msg_types = {0:[0, "CHOKE"], 1:[0, "UNCHOKE"], 2:[0, "INTERESTED"], 3: [0, "NOT_INTERESTED"], \
- 4:[0, "HAVE"], 5:[0, "BITFIELD"], 6:[0, "REQUEST"], 7:[0, "PIECE"], 8:[0, "CANCEL"], \
- 9:[0, "DHT_PORT"]}
- dbname = 'test.db'
- vbmc = VerboseMessageCollection(dbname, 4);
- vbmcit = vbmc.getIter()
- while True:
- try:
- vbm = next(vbmcit)
- except StopIteration:
- break
- msg_types[vbm.message_type][0] = msg_types[vbm.message_type][0] + 1;
-
- print msg_types
- fig = plt.figure()
- ax = fig.add_subplot(111)
- plt.subplots_adjust(left=0.13, right=0.90)
- vals = []
- ticks = []
- pos = np.arange(len(msg_types))+.3
- for list in msg_types.values():
- vals.append(list[0])
- ticks.append(list[1])
- ax.barh(pos, vals, height=0.3, align='center')
- ax.grid(True)
- plt.yticks(pos, ticks)
- #ax.set_yticklabels(ticks);
- plt.show()
-
-
-if __name__ == "__main__":
- sys.exit(main())