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
488c0671
Commit
488c0671
authored
Jun 04, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add histogram printing for RTT
parent
81f06fbd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
14 deletions
+32
-14
packet-exchange/src/client.c
packet-exchange/src/client.c
+32
-14
No files found.
packet-exchange/src/client.c
View file @
488c0671
...
@@ -250,6 +250,9 @@ static void do_tsn_task(struct thread_param *param, uint64_t next_txtime) {
...
@@ -250,6 +250,9 @@ static void do_tsn_task(struct thread_param *param, uint64_t next_txtime) {
clock_gettime
(
CLOCK_MONOTONIC
,
&
t2
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
t2
);
param
->
stats
.
rtt
=
calcdiff_ns
(
t2
,
t1
);
param
->
stats
.
rtt
=
calcdiff_ns
(
t2
,
t1
);
if
(
enable_histograms
)
histograms
[
0
][
param
->
stats
.
rtt
]
++
;
}
}
}
}
...
@@ -258,6 +261,7 @@ static void print_histograms() {
...
@@ -258,6 +261,7 @@ static void print_histograms() {
uint64_t
duration
;
uint64_t
duration
;
int
duration_hour
,
duration_minutes
,
interval
;
int
duration_hour
,
duration_minutes
,
interval
;
int
max_hist_val
,
nb_hists
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
measures_end
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
measures_end
);
...
@@ -267,27 +271,41 @@ static void print_histograms() {
...
@@ -267,27 +271,41 @@ static void print_histograms() {
interval
=
param
->
interval
/
1000
;
interval
=
param
->
interval
/
1000
;
printf
(
"{
\"
measure_sets
\"
: [{"
if
(
tsn_task
==
SEND_PACKET_TASK
)
{
"
\"
measure_type
\"
:
\"
packet_send_timestamps
\"
,"
printf
(
"{
\"
measure_sets
\"
: [{"
"
\"
props_names
\"
: [
\"
user_space
\"
,
\"
kernel_space
\"
],"
"
\"
measure_type
\"
:
\"
packet_send_timestamps
\"
,"
"
\"
units
\"
: [
\"
us
\"
,
\"
us
\"
],"
"
\"
props_names
\"
: [
\"
user_space
\"
,
\"
kernel_space
\"
],"
"
\"
props_type
\"
:
\"
histogram
\"
,"
"
\"
units
\"
: [
\"
us
\"
,
\"
us
\"
],"
"
\"
metadata
\"
: {"
"
\"
props_type
\"
:
\"
histogram
\"
,"
"
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
"
"
\"
metadata
\"
: {"
"},"
"
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
"
"
\"
props
\"
: ["
,
interval
,
duration_hour
,
duration_minutes
);
"},"
"
\"
props
\"
: ["
,
interval
,
duration_hour
,
duration_minutes
);
int
max_hist_val
=
0
;
}
else
if
(
tsn_task
==
RTT_TASK
)
{
for
(
int
i
=
0
;
i
<
2
;
i
++
)
printf
(
"{
\"
measure_sets
\"
: [{"
"
\"
measure_type
\"
:
\"
packet_rtt
\"
,"
"
\"
props_names
\"
: [
\"
rtt
\"
],"
"
\"
units
\"
: [
\"
us
\"
],"
"
\"
props_type
\"
:
\"
histogram
\"
,"
"
\"
metadata
\"
: {"
"
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
"
"},"
"
\"
props
\"
: ["
,
interval
,
duration_hour
,
duration_minutes
);
}
nb_hists
=
tsn_task
==
SEND_PACKET_TASK
?
2
:
1
;
max_hist_val
=
0
;
for
(
int
i
=
0
;
i
<
nb_hists
;
i
++
)
for
(
int
j
=
0
;
j
<
MAX_HIST_VAL
;
j
++
)
for
(
int
j
=
0
;
j
<
MAX_HIST_VAL
;
j
++
)
if
(
histograms
[
i
][
j
])
if
(
histograms
[
i
][
j
])
max_hist_val
=
j
>
max_hist_val
?
j
:
max_hist_val
;
max_hist_val
=
j
>
max_hist_val
?
j
:
max_hist_val
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
for
(
int
i
=
0
;
i
<
nb_hists
;
i
++
)
{
printf
(
"["
);
printf
(
"["
);
for
(
int
j
=
0
;
j
<
max_hist_val
;
j
++
)
for
(
int
j
=
0
;
j
<
max_hist_val
;
j
++
)
printf
(
"%"
PRIi64
"%s"
,
histograms
[
i
][
j
],
(
j
+
1
<
max_hist_val
?
", "
:
""
));
printf
(
"%"
PRIi64
"%s"
,
histograms
[
i
][
j
],
(
j
+
1
<
max_hist_val
?
", "
:
""
));
printf
(
"%s"
,
(
i
+
1
<
2
?
"], "
:
"]"
));
printf
(
"%s"
,
(
i
+
1
<
nb_hists
?
"], "
:
"]"
));
}
}
printf
(
"]}]}
\n
"
);
printf
(
"]}]}
\n
"
);
...
...
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