Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tsn-measures
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
tsn-measures
Commits
551e86c2
Commit
551e86c2
authored
Jun 10, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update txtime_stats script to print a histogram to a file
parent
23419f94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
4 deletions
+29
-4
scripts/txtime_stats.py
scripts/txtime_stats.py
+29
-4
No files found.
scripts/txtime_stats.py
View file @
551e86c2
...
@@ -28,6 +28,16 @@ import math
...
@@ -28,6 +28,16 @@ import math
import
sys
import
sys
def
compute_offsets_stats
(
file_path
):
def
compute_offsets_stats
(
file_path
):
measure_set
=
{}
measure_set
[
"measure_type"
]
=
"packet_jitter_tcpdump"
measure_set
[
"props_names"
]
=
[
"packet_jitter_tcpdump"
]
measure_set
[
"units"
]
=
[
"us"
]
measure_set
[
"props_type"
]
=
[
"histogram"
]
measure_set
[
"metadata"
]
=
{
"i"
:
interval
}
histogram
=
[
0
for
i
in
range
(
0
,
2000
)]
with
open
(
file_path
)
as
f
:
with
open
(
file_path
)
as
f
:
min_t
=
sys
.
maxsize
min_t
=
sys
.
maxsize
max_t
=
-
sys
.
maxsize
max_t
=
-
sys
.
maxsize
...
@@ -40,17 +50,32 @@ def compute_offsets_stats(file_path):
...
@@ -40,17 +50,32 @@ def compute_offsets_stats(file_path):
if
i
>
0
:
if
i
>
0
:
val
=
arrival_tstamp
-
prev_tstamp
val
=
arrival_tstamp
-
prev_tstamp
jitter
=
(
val
-
interval
)
/
1000
histogram_index
=
1000
+
jitter
if
histogram_index
<
0
or
histogram_index
>
2000
:
print
(
"jitter too high: {}
\
n
"
.
format
(
jitter
))
else
:
histogram
[
histogram_index
]
++
# Update statistics.
# Update statistics.
# Compute the mean and variance online using Welford's algorithm.
min_t
=
jitter
if
jitter
<
min_t
else
min_t
min_t
=
val
if
val
<
min_t
else
min_t
max_t
=
jitter
if
jitter
>
max_t
else
max_t
max_t
=
val
if
val
>
max_t
else
max_t
i
+=
1
i
+=
1
prev_tstamp
=
arrival_tstamp
prev_tstamp
=
arrival_tstamp
if
i
>
0
:
if
i
>
0
:
print
(
"Jitter: "
+
str
((
max_t
-
min_t
)
/
1000
)
+
"us"
)
print
(
"Jitter: {}us"
.
format
(
max_t
-
min_t
))
measure_set
[
"props"
]
=
[
histogram
]
data
=
{}
data
[
"measure_sets"
]
=
[{
measure_set
}]
path
=
"tcpdump_histogram"
with
open
(
path
,
'w'
)
as
outfile
:
json
.
dump
(
data
,
outfile
)
def
main
():
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
...
...
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