Commit 2e1c186b authored by Michael König (Student)'s avatar Michael König (Student)
Browse files

misc. bug-fixes

parent be03a503
...@@ -74,16 +74,18 @@ class LiveGui(GuiBase): ...@@ -74,16 +74,18 @@ class LiveGui(GuiBase):
"""Toggles visibility for given line.""" """Toggles visibility for given line."""
self.lineVisibility[lineID] ^= True self.lineVisibility[lineID] ^= True
for flowIdentifier in self.__connectionBuffer: for flowIdentifier in self.__connectionBuffer:
self.__plotLineConfigs[flowIdentifier][lineID] ^= True if(flowIdentifier in self.flows and flowIdentifier in self.__plotLineConfigs):
self.__plotLines[flowIdentifier][lineID].set_visible(self.__plotLineConfigs[flowIdentifier][lineID]) self.__plotLineConfigs[flowIdentifier][lineID] ^= True
self.__plotLines[flowIdentifier][lineID].set_visible(self.__plotLineConfigs[flowIdentifier][lineID])
self.drawPlotLegend() self.drawPlotLegend()
def updateValueVisibility(self, label): def updateValueVisibility(self, label):
for flowIdentifier in self.__connectionBuffer: for flowIdentifier in self.__connectionBuffer:
for i in range(1, len(VALUES_TO_PLOT)+1): for i in range(1, len(VALUES_TO_PLOT)+1):
self.__plotLineConfigs[flowIdentifier][VALUES_TO_PLOT[(i-1)]] = False if(flowIdentifier in self.flows and flowIdentifier in self.__plotLineConfigs):
self.__plotLines[flowIdentifier][(VALUES_TO_PLOT[(i-1)])].set_visible(self.__plotLineConfigs[flowIdentifier][(VALUES_TO_PLOT[(i-1)])]) self.__plotLineConfigs[flowIdentifier][VALUES_TO_PLOT[(i-1)]] = False
self.__plotLines[flowIdentifier][(VALUES_TO_PLOT[(i-1)])].set_visible(self.__plotLineConfigs[flowIdentifier][(VALUES_TO_PLOT[(i-1)])])
if label == 'cwnd': if label == 'cwnd':
self.toggleVisibility(VALUES_TO_PLOT[0]) self.toggleVisibility(VALUES_TO_PLOT[0])
elif label == 'sst': elif label == 'sst':
...@@ -101,7 +103,7 @@ class LiveGui(GuiBase): ...@@ -101,7 +103,7 @@ class LiveGui(GuiBase):
labelObjs = [] labelObjs = []
labelTexts = [] labelTexts = []
for flowIdentifier in self.__connectionBuffer: for flowIdentifier in self.__connectionBuffer:
if(flowIdentifier in self.flows): if(flowIdentifier in self.flows and flowIdentifier in self.__plotLineConfigs):
for val in VALUES_TO_PLOT: for val in VALUES_TO_PLOT:
if(self.__plotLineConfigs[flowIdentifier][val]): if(self.__plotLineConfigs[flowIdentifier][val]):
labelObjs.append(self.__plotLines[flowIdentifier][val]) labelObjs.append(self.__plotLines[flowIdentifier][val])
...@@ -354,7 +356,13 @@ class LiveGui(GuiBase): ...@@ -354,7 +356,13 @@ class LiveGui(GuiBase):
if(flowIdentifier not in self.flows): if(flowIdentifier not in self.flows):
continue continue
lineTime = self.__initRealtimeTimestamp + (float(data['time']) - self.__initSampletimeTimestamp) try:
dataTime = float(data['time'])
except ValueError:
continue
else:
lineTime = self.__initRealtimeTimestamp + (dataTime - self.__initSampletimeTimestamp)
# time in past # time in past
if(lineTime < newXmin): if(lineTime < newXmin):
continue continue
...@@ -388,15 +396,13 @@ class LiveGui(GuiBase): ...@@ -388,15 +396,13 @@ class LiveGui(GuiBase):
data = 0 data = 0
for flowIdentifier in connectionsData: for flowIdentifier in connectionsData:
if(len(connectionsData[flowIdentifier]) > 0): if(len(connectionsData[flowIdentifier]) > 0 and len(self.flows) > 0 and flowIdentifier in self.flows):
data += 1 data += 1
for flowIdentifier in self.__connectionBuffer: for flowIdentifier in self.__connectionBuffer:
if(data < 1 and currentTimestamp > self.__lastPlotTimestamp[flowIdentifier] ): if(data < 1 and currentTimestamp > self.__lastPlotTimestamp[flowIdentifier] ):
if(self.options.debug): if(self.options.debug):
print("No data for any connection.") print("No data for any connection.")
if(self.options.interimBuffering):
self.__preloading = True
return self.returnAllLines() return self.returnAllLines()
...@@ -406,8 +412,14 @@ class LiveGui(GuiBase): ...@@ -406,8 +412,14 @@ class LiveGui(GuiBase):
while(len(connectionsData[connection]) > 0): while(len(connectionsData[connection]) > 0):
data = connectionsData[connection].popleft() data = connectionsData[connection].popleft()
lineTime = self.__initRealtimeTimestamp + (float(data['time']) - self.__initSampletimeTimestamp)
self.__plotLineConfigs[connection]['lastTimestamp'] = float(data['time']) try:
dataTime = float(data['time'])
except ValueError:
continue
else:
lineTime = self.__initRealtimeTimestamp + (dataTime - self.__initSampletimeTimestamp)
self.__plotLineConfigs[connection]['lastTimestamp'] = dataTime
for val in VALUES_TO_PROCESS: for val in VALUES_TO_PROCESS:
if(val == 'time'): if(val == 'time'):
...@@ -497,6 +509,11 @@ class LiveGui(GuiBase): ...@@ -497,6 +509,11 @@ class LiveGui(GuiBase):
# print(data) # print(data)
#re-add first sample (to head of dequeue) #re-add first sample (to head of dequeue)
self.__connectionBuffer[flowIdentifier].appendleft(data) self.__connectionBuffer[flowIdentifier].appendleft(data)
self.__initSampletimeTimestamp = float(data['time']) try:
dataTime = float(data['time'])
except ValueError:
continue
else:
self.__initSampletimeTimestamp = dataTime
return return
...@@ -235,13 +235,12 @@ def parse_options(): ...@@ -235,13 +235,12 @@ def parse_options():
parser.add_argument( parser.add_argument(
"-p", "-p",
"--port", "--port",
help="Filter by port. Multiple occurrences possible (" + str(DEFAULT_FILTER_PORT) + ")", help="Filter by dst-port. Multiple occurrences possible (" + str(DEFAULT_FILTER_PORT) + ")",
dest="filterPorts", dest="filterPorts",
action='append', action='append',
type=int, type=int,
default=[]) default=[])
parser.add_argument( parser.add_argument(
"--version", "--version",
help="Print version information", help="Print version information",
......
...@@ -79,14 +79,18 @@ class TcpLivePlot(): ...@@ -79,14 +79,18 @@ class TcpLivePlot():
if(len(tmpData) == len(LOG_FORMAT)): if(len(tmpData) == len(LOG_FORMAT)):
data = dict(zip(LOG_FORMAT, tmpData)) data = dict(zip(LOG_FORMAT, tmpData))
# print(data) # print(data)
srcPort = int(data['srcPort']) try:
dstPort = int(data['dstPort']) srcPort = int(data['srcPort'])
if(dstPort in self.options.filterPorts): dstPort = int(data['dstPort'])
flowIdentifier = str(srcPort) + "-" + str(dstPort) except ValueError:
if(flowIdentifier not in self.connectionBuffer): continue
self.connectionBuffer[flowIdentifier] = deque() else:
self.connectionBuffer[flowIdentifier].append(data) if(dstPort in self.options.filterPorts):
# self.incomeBuffer.append(sample) flowIdentifier = str(srcPort) + "-" + str(dstPort)
if(flowIdentifier not in self.connectionBuffer):
self.connectionBuffer[flowIdentifier] = deque()
self.connectionBuffer[flowIdentifier].append(data)
# self.incomeBuffer.append(sample)
def processGui(self): def processGui(self):
# while(not self.__stopped.wait(THREAD_STOPFLAG_WAIT)): # while(not self.__stopped.wait(THREAD_STOPFLAG_WAIT)):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment