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
b62397e6
Commit
b62397e6
authored
Jun 24, 2020
by
Joanne Hugé
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up histogram printing and fix missing bracket
parent
8f5998b7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
55 deletions
+37
-55
packet-exchange/src/client.c
packet-exchange/src/client.c
+9
-22
packet-exchange/src/common.c
packet-exchange/src/common.c
+14
-0
packet-exchange/src/common.h
packet-exchange/src/common.h
+3
-0
packet-exchange/src/server.c
packet-exchange/src/server.c
+11
-33
No files found.
packet-exchange/src/client.c
View file @
b62397e6
...
...
@@ -310,17 +310,12 @@ static void print_histograms() {
"
\"
props_names
\"
: [
\"
user_space
\"
,
\"
kernel_space
\"
],"
"
\"
units
\"
: [
\"
us
\"
,
\"
us
\"
],"
"
\"
props_type
\"
:
\"
histogram
\"
,"
"
\"
metadata
\"
: {"
"
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
,
\"
etf_offset
\"
:
\"
%dus
\"
,"
"},"
"
\"
props
\"
: ["
,
"
\"
metadata
\"
: {
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
,
\"
etf_offset
\"
:
\"
%dus
\"
,},"
"
\"
props
\"
: [["
,
interval
,
duration_hour
,
duration_minutes
,
thread_params
.
etf_offset
);
histogram
=
kernel_latency_hist
;
max_hist_val
=
0
;
for
(
int
j
=
0
;
j
<
MAX_KERNEL_LATENCY
;
j
++
)
if
(
histogram
[
j
])
max_hist_val
=
j
>
max_hist_val
?
j
:
max_hist_val
;
histogram
=
kernel_latency_hist
;
max_hist_val
=
histogram_max
(
histogram
,
MAX_KERNEL_LATENCY
-
1
);
}
else
{
printf
(
"{
\"
measure_sets
\"
: [{"
...
...
@@ -328,25 +323,17 @@ static void print_histograms() {
"
\"
props_names
\"
: [
\"
rtt
\"
],"
"
\"
units
\"
: [
\"
us
\"
],"
"
\"
props_type
\"
:
\"
histogram
\"
,"
"
\"
metadata
\"
: {"
"
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
,
\"
etf_offset
\"
:
\"
%dus
\"
,"
"},"
"
\"
props
\"
: ["
,
"
\"
metadata
\"
: {
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
,
\"
etf_offset
\"
:
\"
%dus
\"
,},"
"
\"
props
\"
: [["
,
interval
,
duration_hour
,
duration_minutes
,
thread_params
.
etf_offset
);
histogram
=
rtt_hist
;
max_hist_val
=
0
;
for
(
int
j
=
0
;
j
<
MAX_RTT
;
j
++
)
if
(
histogram
[
j
])
max_hist_val
=
j
>
max_hist_val
?
j
:
max_hist_val
;
histogram
=
rtt_hist
;
max_hist_val
=
histogram_max
(
histogram
,
MAX_RTT
-
1
);
}
printf
(
"["
);
for
(
int
j
=
0
;
j
<
max_hist_val
;
j
++
)
printf
(
"%"
PRIi64
"%s"
,
histogram
[
j
],
(
j
+
1
<
max_hist_val
?
", "
:
""
));
printf
(
"]"
);
printf
(
"]}]}
\n
"
);
printf
(
"]]}]}
\n
"
);
}
static
void
sighand
(
int
sig_num
)
{
...
...
packet-exchange/src/common.c
View file @
b62397e6
...
...
@@ -35,6 +35,20 @@ uint64_t calcdiff_ns(struct timespec t1, struct timespec t2) {
int
max
(
int
a
,
int
b
)
{
return
a
>
b
?
a
:
b
;
}
int
min
(
int
a
,
int
b
)
{
return
a
<
b
?
a
:
b
;
}
int
histogram_min
(
uint64_t
*
histogram
,
int
max_value
)
{
int
ret
=
max_value
;
for
(
int
i
=
max_value
;
i
>=
0
;
i
--
)
ret
=
histogram
[
i
]
?
i
:
ret
;
return
ret
;
}
int
histogram_max
(
uint64_t
*
histogram
,
int
max_value
)
{
int
ret
=
0
;
for
(
int
i
=
0
;
i
<=
max_value
;
i
++
)
ret
=
histogram
[
i
]
?
i
:
ret
;
return
ret
;
}
static
void
sighand_wrapper
(
int
sig
)
{
// If we get un unexpected signal, report it, if not print the histogram
...
...
packet-exchange/src/common.h
View file @
b62397e6
...
...
@@ -29,6 +29,9 @@ void init_signals(void (*_sighand)(int), int enable_histograms);
int
min
(
int
a
,
int
b
);
int
max
(
int
a
,
int
b
);
int
histogram_min
(
uint64_t
*
histogram
,
int
max_value
);
int
histogram_max
(
uint64_t
*
histogram
,
int
max_value
);
extern
void
(
*
previous_handlers
[
NSIG
])(
int
);
#endif
packet-exchange/src/server.c
View file @
b62397e6
...
...
@@ -271,58 +271,36 @@ static void print_histograms() {
if
(
enable_timestamps
)
{
printf
(
"{
\"
measure_sets
\"
: [{"
"
\"
measure_type
\"
:
\"
packet_recv_timestamps
\"
,"
"
\"
props_names
\"
: [
\"
user_space
\"
,
\"
kernel_space
\"
],"
"
\"
units
\"
: [
\"
us
\"
,
\"
us
\"
],"
"
\"
props_names
\"
: [
\"
kernel_space
\"
],"
"
\"
units
\"
: [
\"
us
\"
],"
"
\"
props_type
\"
:
\"
histogram
\"
,"
"
\"
metadata
\"
: {"
"
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
"
"},"
"
\"
props
\"
: ["
,
"
\"
metadata
\"
:
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
},"
"
\"
props
\"
: [["
,
interval
,
duration_hour
,
duration_minutes
);
max_latency
=
0
;
for
(
int
j
=
0
;
j
<
MAX_KERNEL_LATENCY
;
j
++
)
if
(
kernel_latency_hist
[
j
])
max_latency
=
j
;
max_latency
=
histogram_max
(
kernel_latency_hist
,
MAX_KERNEL_LATENCY
-
1
);
printf
(
"["
);
for
(
int
j
=
0
;
j
<
max_latency
;
j
++
)
printf
(
"%"
PRIi64
"%s"
,
kernel_latency_hist
[
j
],
(
j
+
1
<
max_latency
?
", "
:
""
));
printf
(
"]"
);
printf
(
"]
]
"
);
}
max_jitter
=
0
;
for
(
int
j
=
0
;
j
<
MAX_JITTER
;
j
++
)
if
(
jitter_hist
[
j
])
max_jitter
=
j
;
max_jitter
=
histogram_max
(
jitter_hist
,
MAX_JITTER
-
1
);
min_jitter
=
histogram_min
(
jitter_hist
,
MAX_JITTER
-
1
);
min_jitter
=
MAX_JITTER
-
1
;
for
(
int
j
=
MAX_JITTER
-
1
;
j
>=
0
;
j
--
)
if
(
jitter_hist
[
j
])
min_jitter
=
j
;
if
(
!
enable_timestamps
)
printf
(
"{
\"
measure_sets
\"
: [{"
);
else
printf
(
"]}, {"
);
printf
(
"%s"
,
enable_timestamps
?
"]}, {"
:
"{
\"
measure_sets
\"
: [{"
);
printf
(
"
\"
measure_type
\"
:
\"
packet_jitter
\"
,"
"
\"
props_names
\"
: [
\"
jitter
\"
],"
"
\"
units
\"
: [
\"
us
\"
],"
"
\"
props_type
\"
:
\"
histogram
\"
,"
"
\"
middle
\"
:
\"
%d
\"
,"
"
\"
metadata
\"
: {"
"
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
"
"},"
"
\"
metadata
\"
: {
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
},"
"
\"
props
\"
: [["
,
MAX_JITTER
/
2
-
min_jitter
,
interval
,
duration_hour
,
duration_minutes
);
MAX_JITTER
/
2
-
min_jitter
,
interval
,
duration_hour
,
duration_minutes
);
for
(
int
j
=
min_jitter
;
j
<
max_jitter
;
j
++
)
printf
(
"%"
PRIi64
"%s"
,
jitter_hist
[
j
],
(
j
+
1
<
max_jitter
?
", "
:
""
));
printf
(
"]]}]}
\n
"
);
}
...
...
Joanne Hugé
@jhuge
mentioned in commit
2aa17b73
·
Jul 31, 2020
mentioned in commit
2aa17b73
mentioned in commit 2aa17b73fd8c7c5a0c0e35ba717a55e84582700d
Toggle commit list
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