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
nexedi
osie
Commits
6103b95e
Commit
6103b95e
authored
Mar 24, 2023
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate analyze Python application and test latency in a new folder.
parent
d594d094
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
0 deletions
+59
-0
rt_analyzer/analyze.py
rt_analyzer/analyze.py
+59
-0
rt_analyzer/test_latency.c
rt_analyzer/test_latency.c
+0
-0
No files found.
rt_analyzer/analyze.py
0 → 100644
View file @
6103b95e
f
=
open
(
"digital.csv"
,
"r"
)
# assume it's 0 by default even if in measurement file it can start with 1
# then we simple loose few records but that's acceptable.
last_channel0_value
=
0
last_channel1_value
=
0
last_channel0_timestamp
=
0.0
last_channel1_timestamp
=
0.0
# keep list of deltas between state change ( 0 -> 1, 1 -> 0)
timestamp_channel0_delta_list
=
[]
timestamp_channel1_delta_list
=
[]
for
line
in
f
.
readlines
()[
1
:
4000
]:
timestamp
,
channel0
,
channel1
=
line
.
split
(
","
)
timestamp
=
float
(
timestamp
)
channel0
=
int
(
channel0
)
channel1
=
int
(
channel1
)
#print timestamp, channel0, channel1
# first time init (for very first record line)
if
timestamp
==
0.0
:
last_channel0_value
=
channel0
last_channel1_value
=
channel1
# a new measurement if when channel{0, 1} value changes from last know one
if
channel0
!=
last_channel0_value
:
# calculate delta
if
last_channel0_timestamp
==
0.0
:
# first time init
delta
=
0
else
:
delta
=
timestamp
-
last_channel0_timestamp
last_channel0_timestamp
=
timestamp
# but always add delta
timestamp_channel0_delta_list
.
append
(
delta
)
if
channel1
!=
last_channel1_value
:
# calculate delta
if
last_channel1_timestamp
==
0.0
:
# first time init
delta
=
0
else
:
delta
=
timestamp
-
last_channel1_timestamp
last_channel1_timestamp
=
timestamp
# but always add delta
timestamp_channel1_delta_list
.
append
(
delta
)
# update for next cycle
last_channel0_value
=
channel0
last_channel1_value
=
channel1
# XXX: find average, mean, standard deviation, etc on these lists of deltas
# convert to nanoseconds
print
"Channel0 deltas (in nanoseconds)"
,
[
round
(
x
*
1000000
,
2
)
for
x
in
timestamp_channel0_delta_list
]
print
"
\
n
Channel1 deltas (in nanoseconds)"
,
[
round
(
x
*
1000000
,
2
)
for
x
in
timestamp_channel1_delta_list
]
f
.
close
()
\ No newline at end of file
coupl
er/test_latency.c
→
rt_analyz
er/test_latency.c
View file @
6103b95e
File moved
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