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
9ef4fea2
Commit
9ef4fea2
authored
Sep 24, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add histogram for diff ts measures
parent
2ba307c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
18 deletions
+46
-18
packet-exchange/src/common.h
packet-exchange/src/common.h
+1
-0
packet-exchange/src/server.c
packet-exchange/src/server.c
+45
-18
No files found.
packet-exchange/src/common.h
View file @
9ef4fea2
...
...
@@ -26,6 +26,7 @@
#define MAX_KERNEL_LATENCY 1000
#define MAX_RTT 1000
#define MAX_JITTER 1000
#define MAX_DIFF_TS 1000
#define MAX_BUFFER_SIZE 1024
...
...
packet-exchange/src/server.c
View file @
9ef4fea2
...
...
@@ -65,6 +65,7 @@ static void sighand(int sig_num);
static
uint64_t
kernel_latency_hist
[
MAX_KERNEL_LATENCY
];
static
uint64_t
jitter_hist
[
MAX_JITTER
];
static
uint64_t
diff_ts_hist
[
MAX_DIFF_TS
];
static
main_param_t
main_params
;
static
thread_param_t
thread_params
;
static
ingress_param_t
ingress_params
;
...
...
@@ -84,6 +85,7 @@ static pthread_cond_t emit_signal_ts_received;
static
int64_t
min_diff_ts
=
INT_MAX
;
static
int64_t
max_diff_ts
=
0
;
static
int64_t
avg_diff_ts
=
0
;
static
uint64_t
high_diff_ts
=
0
;
static
char
ts_tracemark_buf
[
64
];
...
...
@@ -264,6 +266,14 @@ static void *tsn_thread(void *p) {
max_diff_ts
=
_max_
(
diff_us
,
max_diff_ts
);
avg_diff_ts
=
(
avg_diff_ts
*
ingress_stats
.
packets_received
+
diff_us
)
/
(
ingress_stats
.
packets_received
+
1
);
// Histogram
if
(
enable_histograms
)
{
if
(
diff_us
>
((
int
)
MAX_DIFF_TS
)
||
diff_us
<
0
)
high_diff_ts
++
;
else
diff_ts_hist
[
diff_us
]
++
;
}
// If the latency hits the tracing threshold, stop tracing
if
(
main_params
.
enable_tracing
&&
(
max_diff_ts
>
((
int64_t
)
thread_params
.
latency_threshold
)))
{
...
...
@@ -400,6 +410,7 @@ int main(int argc, char *argv[]) {
if
(
enable_histograms
)
{
memset
(
kernel_latency_hist
,
0
,
sizeof
(
kernel_latency_hist
));
memset
(
jitter_hist
,
0
,
sizeof
(
jitter_hist
));
memset
(
diff_ts_hist
,
0
,
sizeof
(
diff_ts_hist
));
}
// Enable ftrace
...
...
@@ -481,35 +492,51 @@ static void print_histograms() {
duration_hour
=
duration
/
NSEC_PER_SEC
/
3600
;
duration_minutes
=
duration
/
NSEC_PER_SEC
/
60
-
duration_hour
*
60
;
max_jitter
=
histogram_max
(
jitter_hist
,
MAX_JITTER
-
1
);
min_jitter
=
histogram_min
(
jitter_hist
,
MAX_JITTER
-
1
);
if
(
thread_params
.
enable_diff_ts
)
{
printf
(
"# RX latency histogram
\n
"
);
if
(
enable_timestamps
)
{
max_latency
=
histogram_max
(
kernel_latency_hist
,
MAX_KERNEL_LATENCY
-
1
);
printf
(
"# Packet RX timestamps histogram
\n
"
);
max_latency
=
histogram_max
(
diff_ts_hist
,
MAX_DIFF_TS
-
1
);
for
(
int
j
=
0
;
j
<
max_latency
;
j
++
)
printf
(
" %06d %015"
PRIi64
"
\n
"
,
j
,
kernel_latency
_hist
[
j
]);
printf
(
" %06d %015"
PRIi64
"
\n
"
,
j
,
diff_ts
_hist
[
j
]);
printf
(
"# Duration: %dh%d
\n
"
"# Lost packets: %"
PRIu64
"
\n
"
,
duration_hour
,
duration_minutes
,
ingress_stats
.
high_jitter
);
duration_hour
,
duration_minutes
,
high_diff_ts
);
}
else
{
printf
(
"# Packet jitter histogram
\n
"
);
max_jitter
=
histogram_max
(
jitter_hist
,
MAX_JITTER
-
1
);
min_jitter
=
histogram_min
(
jitter_hist
,
MAX_JITTER
-
1
);
for
(
int
j
=
min_jitter
;
j
<
max_jitter
;
j
++
)
printf
(
" %06d %015"
PRIi64
"
\n
"
,
j
,
jitter_hist
[
j
]
);
if
(
enable_timestamps
)
{
max_latency
=
histogram_max
(
kernel_latency_hist
,
MAX_KERNEL_LATENCY
-
1
);
printf
(
"# Middle: %d
\n
"
"# Duration: %dh%d
\n
"
"# Lost packets: %"
PRIu64
"
\n
"
,
MAX_JITTER
/
2
-
min_jitter
,
duration_hour
,
duration_minutes
,
ingress_stats
.
high_jitter
);
printf
(
"# Packet RX timestamps histogram
\n
"
);
for
(
int
j
=
0
;
j
<
max_latency
;
j
++
)
printf
(
" %06d %015"
PRIi64
"
\n
"
,
j
,
kernel_latency_hist
[
j
]);
printf
(
"# Duration: %dh%d
\n
"
"# Lost packets: %"
PRIu64
"
\n
"
,
duration_hour
,
duration_minutes
,
ingress_stats
.
high_jitter
);
}
printf
(
"# Packet jitter histogram
\n
"
);
for
(
int
j
=
min_jitter
;
j
<
max_jitter
;
j
++
)
printf
(
" %06d %015"
PRIi64
"
\n
"
,
j
,
jitter_hist
[
j
]);
printf
(
"# Middle: %d
\n
"
"# Duration: %dh%d
\n
"
"# Lost packets: %"
PRIu64
"
\n
"
,
MAX_JITTER
/
2
-
min_jitter
,
duration_hour
,
duration_minutes
,
ingress_stats
.
high_jitter
);
}
}
...
...
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