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
Show 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 @@
...
@@ -26,6 +26,7 @@
#define MAX_KERNEL_LATENCY 1000
#define MAX_KERNEL_LATENCY 1000
#define MAX_RTT 1000
#define MAX_RTT 1000
#define MAX_JITTER 1000
#define MAX_JITTER 1000
#define MAX_DIFF_TS 1000
#define MAX_BUFFER_SIZE 1024
#define MAX_BUFFER_SIZE 1024
...
...
packet-exchange/src/server.c
View file @
9ef4fea2
...
@@ -65,6 +65,7 @@ static void sighand(int sig_num);
...
@@ -65,6 +65,7 @@ static void sighand(int sig_num);
static
uint64_t
kernel_latency_hist
[
MAX_KERNEL_LATENCY
];
static
uint64_t
kernel_latency_hist
[
MAX_KERNEL_LATENCY
];
static
uint64_t
jitter_hist
[
MAX_JITTER
];
static
uint64_t
jitter_hist
[
MAX_JITTER
];
static
uint64_t
diff_ts_hist
[
MAX_DIFF_TS
];
static
main_param_t
main_params
;
static
main_param_t
main_params
;
static
thread_param_t
thread_params
;
static
thread_param_t
thread_params
;
static
ingress_param_t
ingress_params
;
static
ingress_param_t
ingress_params
;
...
@@ -84,6 +85,7 @@ static pthread_cond_t emit_signal_ts_received;
...
@@ -84,6 +85,7 @@ static pthread_cond_t emit_signal_ts_received;
static
int64_t
min_diff_ts
=
INT_MAX
;
static
int64_t
min_diff_ts
=
INT_MAX
;
static
int64_t
max_diff_ts
=
0
;
static
int64_t
max_diff_ts
=
0
;
static
int64_t
avg_diff_ts
=
0
;
static
int64_t
avg_diff_ts
=
0
;
static
uint64_t
high_diff_ts
=
0
;
static
char
ts_tracemark_buf
[
64
];
static
char
ts_tracemark_buf
[
64
];
...
@@ -264,6 +266,14 @@ static void *tsn_thread(void *p) {
...
@@ -264,6 +266,14 @@ static void *tsn_thread(void *p) {
max_diff_ts
=
_max_
(
diff_us
,
max_diff_ts
);
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
);
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 the latency hits the tracing threshold, stop tracing
if
(
main_params
.
enable_tracing
&&
if
(
main_params
.
enable_tracing
&&
(
max_diff_ts
>
((
int64_t
)
thread_params
.
latency_threshold
)))
{
(
max_diff_ts
>
((
int64_t
)
thread_params
.
latency_threshold
)))
{
...
@@ -400,6 +410,7 @@ int main(int argc, char *argv[]) {
...
@@ -400,6 +410,7 @@ int main(int argc, char *argv[]) {
if
(
enable_histograms
)
{
if
(
enable_histograms
)
{
memset
(
kernel_latency_hist
,
0
,
sizeof
(
kernel_latency_hist
));
memset
(
kernel_latency_hist
,
0
,
sizeof
(
kernel_latency_hist
));
memset
(
jitter_hist
,
0
,
sizeof
(
jitter_hist
));
memset
(
jitter_hist
,
0
,
sizeof
(
jitter_hist
));
memset
(
diff_ts_hist
,
0
,
sizeof
(
diff_ts_hist
));
}
}
// Enable ftrace
// Enable ftrace
...
@@ -481,6 +492,21 @@ static void print_histograms() {
...
@@ -481,6 +492,21 @@ static void print_histograms() {
duration_hour
=
duration
/
NSEC_PER_SEC
/
3600
;
duration_hour
=
duration
/
NSEC_PER_SEC
/
3600
;
duration_minutes
=
duration
/
NSEC_PER_SEC
/
60
-
duration_hour
*
60
;
duration_minutes
=
duration
/
NSEC_PER_SEC
/
60
-
duration_hour
*
60
;
if
(
thread_params
.
enable_diff_ts
)
{
printf
(
"# RX latency 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
,
diff_ts_hist
[
j
]);
printf
(
"# Duration: %dh%d
\n
"
"# Lost packets: %"
PRIu64
"
\n
"
,
duration_hour
,
duration_minutes
,
high_diff_ts
);
}
else
{
max_jitter
=
histogram_max
(
jitter_hist
,
MAX_JITTER
-
1
);
max_jitter
=
histogram_max
(
jitter_hist
,
MAX_JITTER
-
1
);
min_jitter
=
histogram_min
(
jitter_hist
,
MAX_JITTER
-
1
);
min_jitter
=
histogram_min
(
jitter_hist
,
MAX_JITTER
-
1
);
...
@@ -510,6 +536,7 @@ static void print_histograms() {
...
@@ -510,6 +536,7 @@ static void print_histograms() {
"# Lost packets: %"
PRIu64
"
\n
"
,
"# Lost packets: %"
PRIu64
"
\n
"
,
MAX_JITTER
/
2
-
min_jitter
,
duration_hour
,
duration_minutes
,
MAX_JITTER
/
2
-
min_jitter
,
duration_hour
,
duration_minutes
,
ingress_stats
.
high_jitter
);
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