Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TCPlivePLOT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CPUnetLOG
TCPlivePLOT
Commits
2e1c186b
Commit
2e1c186b
authored
Nov 04, 2016
by
Michael König
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc. bug-fixes
parent
be03a503
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
22 deletions
+42
-22
tcpliveplot/backends/gui/live.py
tcpliveplot/backends/gui/live.py
+29
-12
tcpliveplot/main.py
tcpliveplot/main.py
+1
-2
tcpliveplot/tcpliveplot.py
tcpliveplot/tcpliveplot.py
+12
-8
No files found.
tcpliveplot/backends/gui/live.py
View file @
2e1c186b
...
...
@@ -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
tcpliveplot/main.py
View file @
2e1c186b
...
...
@@ -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"
,
...
...
tcpliveplot/tcpliveplot.py
View file @
2e1c186b
...
...
@@ -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)):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment