Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
osie
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Manchev
osie
Commits
ed6e432b
Commit
ed6e432b
authored
Jun 02, 2023
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Multicast keep alive
parent
816b248e
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
374 additions
and
2 deletions
+374
-2
multicast-keep-alive/receiver.py
multicast-keep-alive/receiver.py
+42
-0
multicast-keep-alive/sender.py
multicast-keep-alive/sender.py
+32
-0
notebooks/beremiz_runtime_measurements/coupler0_duration.txt
notebooks/beremiz_runtime_measurements/coupler0_duration.txt
+0
-0
notebooks/beremiz_runtime_measurements/coupler1_duration.txt
notebooks/beremiz_runtime_measurements/coupler1_duration.txt
+0
-0
notebooks/beremiz_runtime_measurements/digital.csv
notebooks/beremiz_runtime_measurements/digital.csv
+0
-0
notebooks/beremiz_runtime_measurements/timestamp_notebook.ipynb
...oks/beremiz_runtime_measurements/timestamp_notebook.ipynb
+1
-1
notebooks/keep_alive_measurements/coupler0_duration.txt
notebooks/keep_alive_measurements/coupler0_duration.txt
+0
-0
notebooks/keep_alive_measurements/coupler1_duration.txt
notebooks/keep_alive_measurements/coupler1_duration.txt
+0
-0
notebooks/keep_alive_measurements/digital.csv
notebooks/keep_alive_measurements/digital.csv
+0
-0
notebooks/keep_alive_measurements/timestamp_notebook.ipynb
notebooks/keep_alive_measurements/timestamp_notebook.ipynb
+1
-1
notebooks/unicats_multicast_measurements/unicast_multicast_measurements.ipynb
...lticast_measurements/unicast_multicast_measurements.ipynb
+298
-0
No files found.
multicast-keep-alive/receiver.py
0 → 100644
View file @
ed6e432b
import
socket
import
struct
import
sys
samples_count
=
int
(
sys
.
argv
[
1
])
multicast_group
=
'224.3.29.71'
server_address
=
(
''
,
10000
)
# Create the socket
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
# Bind to the server address
sock
.
bind
(
server_address
)
# Tell the operating system to add the socket to the multicast group
# on all interfaces.
group
=
socket
.
inet_aton
(
multicast_group
)
mreq
=
struct
.
pack
(
'4sL'
,
group
,
socket
.
INADDR_ANY
)
sock
.
setsockopt
(
socket
.
IPPROTO_IP
,
socket
.
IP_ADD_MEMBERSHIP
,
mreq
)
last_micro_second
=
0
# Receive/respond loop
i
=
0
l
=
[]
while
i
<
samples_count
:
data
,
address
=
sock
.
recvfrom
(
1024
)
current_micro_second
=
int
(
data
)
diff
=
current_micro_second
-
last_micro_second
#if diff > 200:
# print >>sys.stderr, diff
last_micro_second
=
current_micro_second
if
i
>
0
:
# omot first cycle as we care for diff between cycles
l
.
append
(
str
(
diff
))
i
+=
1
# save to file
hostname
=
socket
.
gethostname
()
f
=
open
(
"report-%s.csv"
%
hostname
,
"w"
)
text
=
"
\
n
"
.
join
(
l
)
f
.
write
(
text
)
f
.
close
()
multicast-keep-alive/sender.py
0 → 100644
View file @
ed6e432b
import
socket
import
struct
import
sys
,
time
multicast_group
=
(
'224.3.29.71'
,
10000
)
# Create the datagram socket
sock
=
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_DGRAM
)
one_microsecond
=
1
/
1000000.0
# Set the time-to-live for messages to 1 so they do not go past the
# local network segment.
ttl
=
struct
.
pack
(
'b'
,
1
)
sock
.
setsockopt
(
socket
.
IPPROTO_IP
,
socket
.
IP_MULTICAST_TTL
,
ttl
)
last_micro_seconds
=
int
(
time
.
time
()
*
1000000
)
# XXX: make CLI arguments
timeout
=
int
(
sys
.
argv
[
1
])
timeout_tolerance
=
int
(
sys
.
argv
[
2
])
warning_limit
=
timeout
+
timeout_tolerance
while
True
:
micro_seconds
=
int
(
time
.
time
()
*
1000000
)
diff
=
micro_seconds
-
last_micro_seconds
last_micro_seconds
=
micro_seconds
message
=
str
(
micro_seconds
)
if
diff
/
1000000
>
warning_limit
:
print
>>
sys
.
stderr
,
'%s'
%
diff
sent
=
sock
.
sendto
(
message
,
multicast_group
)
time
.
sleep
(
timeout
*
one_microsecond
)
# wait interval
sock
.
close
()
rt_analyzer/
notebooks/beremiz_runtime_measurements/coupler0_duration.txt
→
notebooks/beremiz_runtime_measurements/coupler0_duration.txt
View file @
ed6e432b
File moved
rt_analyzer/
notebooks/beremiz_runtime_measurements/coupler1_duration.txt
→
notebooks/beremiz_runtime_measurements/coupler1_duration.txt
View file @
ed6e432b
File moved
rt_analyzer/
notebooks/beremiz_runtime_measurements/digital.csv
→
notebooks/beremiz_runtime_measurements/digital.csv
View file @
ed6e432b
File moved
rt_analyzer/
notebooks/beremiz_runtime_measurements/timestamp_notebook.ipynb
→
notebooks/beremiz_runtime_measurements/timestamp_notebook.ipynb
View file @
ed6e432b
...
@@ -259,7 +259,7 @@
...
@@ -259,7 +259,7 @@
"name": "python",
"name": "python",
"nbconvert_exporter": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"pygments_lexer": "ipython3",
"version": "3.
10.6
"
"version": "3.
8.10
"
}
}
},
},
"nbformat": 4,
"nbformat": 4,
...
...
rt_analyzer/
notebooks/keep_alive_measurements/coupler0_duration.txt
→
notebooks/keep_alive_measurements/coupler0_duration.txt
View file @
ed6e432b
File moved
rt_analyzer/
notebooks/keep_alive_measurements/coupler1_duration.txt
→
notebooks/keep_alive_measurements/coupler1_duration.txt
View file @
ed6e432b
File moved
rt_analyzer/
notebooks/keep_alive_measurements/digital.csv
→
notebooks/keep_alive_measurements/digital.csv
View file @
ed6e432b
File moved
rt_analyzer/
notebooks/keep_alive_measurements/timestamp_notebook.ipynb
→
notebooks/keep_alive_measurements/timestamp_notebook.ipynb
View file @
ed6e432b
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
"name": "python",
"name": "python",
"nbconvert_exporter": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"pygments_lexer": "ipython3",
"version": "3.
10.6
"
"version": "3.
8.10
"
}
}
},
},
"nbformat": 4,
"nbformat": 4,
...
...
notebooks/unicats_multicast_measurements/unicast_multicast_measurements.ipynb
0 → 100644
View file @
ed6e432b
This diff is collapsed.
Click to expand it.
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