Commit 2e1c186b authored by Michael König's avatar Michael König

misc. bug-fixes

parent be03a503
......@@ -74,16 +74,18 @@ class LiveGui(GuiBase):
"""Toggles visibility for given line."""
self.lineVisibility[lineID] ^= True
for flowIdentifier in self.__connectionBuffer:
self.__plotLineConfigs[flowIdentifier][lineID] ^= True
self.__plotLines[flowIdentifier][lineID].set_visible(self.__plotLineConfigs[flowIdentifier][lineID])
if(flowIdentifier in self.flows and flowIdentifier in self.__plotLineConfigs):
self.__plotLineConfigs[flowIdentifier][lineID] ^= True
self.__plotLines[flowIdentifier][lineID].set_visible(self.__plotLineConfigs[flowIdentifier][lineID])
self.drawPlotLegend()
def updateValueVisibility(self, label):
for flowIdentifier in self.__connectionBuffer:
for i in range(1, len(VALUES_TO_PLOT)+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(flowIdentifier in self.flows and flowIdentifier in self.__plotLineConfigs):
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':
self.toggleVisibility(VALUES_TO_PLOT[0])
elif label == 'sst':
......@@ -101,7 +103,7 @@ class LiveGui(GuiBase):
labelObjs = []
labelTexts = []
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:
if(self.__plotLineConfigs[flowIdentifier][val]):
labelObjs.append(self.__plotLines[flowIdentifier][val])
......@@ -354,7 +356,13 @@ class LiveGui(GuiBase):
if(flowIdentifier not in self.flows):
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
if(lineTime < newXmin):
continue
......@@ -388,15 +396,13 @@ class LiveGui(GuiBase):
data = 0
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
for flowIdentifier in self.__connectionBuffer:
if(data < 1 and currentTimestamp > self.__lastPlotTimestamp[flowIdentifier] ):
if(self.options.debug):
print("No data for any connection.")
if(self.options.interimBuffering):
self.__preloading = True
return self.returnAllLines()
......@@ -406,8 +412,14 @@ class LiveGui(GuiBase):
while(len(connectionsData[connection]) > 0):
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:
if(val == 'time'):
......@@ -497,6 +509,11 @@ class LiveGui(GuiBase):
# print(data)
#re-add first sample (to head of dequeue)
self.__connectionBuffer[flowIdentifier].appendleft(data)
self.__initSampletimeTimestamp = float(data['time'])
try:
dataTime = float(data['time'])
except ValueError:
continue
else:
self.__initSampletimeTimestamp = dataTime
return
......@@ -235,13 +235,12 @@ def parse_options():
parser.add_argument(
"-p",
"--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",
action='append',
type=int,
default=[])
parser.add_argument(
"--version",
help="Print version information",
......
......@@ -79,14 +79,18 @@ class TcpLivePlot():
if(len(tmpData) == len(LOG_FORMAT)):
data = dict(zip(LOG_FORMAT, tmpData))
# print(data)
srcPort = int(data['srcPort'])
dstPort = int(data['dstPort'])
if(dstPort in self.options.filterPorts):
flowIdentifier = str(srcPort) + "-" + str(dstPort)
if(flowIdentifier not in self.connectionBuffer):
self.connectionBuffer[flowIdentifier] = deque()
self.connectionBuffer[flowIdentifier].append(data)
# self.incomeBuffer.append(sample)
try:
srcPort = int(data['srcPort'])
dstPort = int(data['dstPort'])
except ValueError:
continue
else:
if(dstPort in self.options.filterPorts):
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):
# 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