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
4982307e
Commit
4982307e
authored
Jun 23, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix all compilation warnings
parent
f4d04550
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
20 deletions
+22
-20
packet-exchange/src/client.c
packet-exchange/src/client.c
+14
-13
packet-exchange/src/server.c
packet-exchange/src/server.c
+8
-7
No files found.
packet-exchange/src/client.c
View file @
4982307e
...
@@ -35,7 +35,7 @@ typedef struct rtt_stat {
...
@@ -35,7 +35,7 @@ typedef struct rtt_stat {
typedef
struct
thread_param
{
typedef
struct
thread_param
{
int
interval
;
int
interval
;
int
max_cycles
;
unsigned
int
max_cycles
;
int
priority
;
int
priority
;
int
etf_offset
;
int
etf_offset
;
...
@@ -55,10 +55,10 @@ static void sighand(int sig_num);
...
@@ -55,10 +55,10 @@ static void sighand(int sig_num);
// Static variables
// Static variables
static
int64_t
kernel_latency_hist
[
MAX_KERNEL_LATENCY
];
static
u
int64_t
kernel_latency_hist
[
MAX_KERNEL_LATENCY
];
static
int64_t
rtt_hist
[
MAX_RTT
];
static
u
int64_t
rtt_hist
[
MAX_RTT
];
static
in
t
nb_cycles
;
static
uint64_
t
nb_cycles
;
static
main_param_t
main_params
;
static
main_param_t
main_params
;
static
thread_param_t
thread_params
;
static
thread_param_t
thread_params
;
...
@@ -103,6 +103,7 @@ static void help(char *argv[]) {
...
@@ -103,6 +103,7 @@ static void help(char *argv[]) {
// Real-time thread
// Real-time thread
// Sends packets at a regular intervall
// Sends packets at a regular intervall
static
void
*
packet_sending_thread
(
void
*
p
)
{
static
void
*
packet_sending_thread
(
void
*
p
)
{
(
void
)
p
;
struct
timespec
next
;
struct
timespec
next
;
uint64_t
next_txtime
;
uint64_t
next_txtime
;
struct
sched_param
priority
;
struct
sched_param
priority
;
...
@@ -135,10 +136,10 @@ static void *packet_sending_thread(void *p) {
...
@@ -135,10 +136,10 @@ static void *packet_sending_thread(void *p) {
// Packet sending loop
// Packet sending loop
for
(
nb_cycles
=
0
;;
nb_cycles
++
)
{
for
(
nb_cycles
=
0
;;
nb_cycles
++
)
{
if
(
thread_params
.
max_cycles
)
if
(
thread_params
.
max_cycles
)
if
(
nb_cycles
>=
thread_params
.
max_cycles
)
if
(
nb_cycles
>=
((
unsigned
int
)
thread_params
.
max_cycles
)
)
break
;
break
;
sprintf
(
send_data
,
"%d"
,
nb_cycles
%
1000
);
sprintf
(
send_data
,
"%d"
,
(
int
)(
nb_cycles
%
1000
)
);
do_tsn_task
(
send_data
,
next_txtime
);
do_tsn_task
(
send_data
,
next_txtime
);
add_ns
(
&
next
,
thread_params
.
interval
);
add_ns
(
&
next
,
thread_params
.
interval
);
...
@@ -186,8 +187,8 @@ int main(int argc, char *argv[]) {
...
@@ -186,8 +187,8 @@ int main(int argc, char *argv[]) {
if
(
enable_histograms
)
{
if
(
enable_histograms
)
{
// Init histograms
// Init histograms
memset
(
kernel_latency_hist
,
0
,
MAX_KERNEL_LATENCY
);
memset
(
kernel_latency_hist
,
0
,
sizeof
(
kernel_latency_hist
)
);
memset
(
rtt_hist
,
0
,
MAX_RTT
);
memset
(
rtt_hist
,
0
,
sizeof
(
rtt_hist
)
);
}
}
// Catch breaks with sighand to print the histograms
// Catch breaks with sighand to print the histograms
...
@@ -217,13 +218,13 @@ int main(int argc, char *argv[]) {
...
@@ -217,13 +218,13 @@ int main(int argc, char *argv[]) {
if
(
main_params
.
verbose
)
{
if
(
main_params
.
verbose
)
{
if
(
tsn_task
==
RTT_TASK
)
{
if
(
tsn_task
==
RTT_TASK
)
{
printf
(
"%10
d
: RTT: %4d %4d %4d
\n
"
,
nb_cycles
,
rtt_stats
.
min_rtt
,
printf
(
"%10
"
PRIu64
"
: RTT: %4d %4d %4d
\n
"
,
nb_cycles
,
rtt_stats
.
min_rtt
,
rtt_stats
.
avg_rtt
,
rtt_stats
.
avg_rtt
,
rtt_stats
.
max_rtt
);
rtt_stats
.
max_rtt
);
printf
(
"
\033
[%dA"
,
1
);
printf
(
"
\033
[%dA"
,
1
);
}
else
if
(
enable_timestamps
)
{
}
else
if
(
enable_timestamps
)
{
printf
(
"%10
d
: K: %4d %4d %4d
\n
"
,
printf
(
"%10
"
PRIu64
"
: K: %4d %4d %4d
\n
"
,
nb_cycles
,
egress_stats
.
min_kernel_latency
,
nb_cycles
,
egress_stats
.
min_kernel_latency
,
egress_stats
.
avg_kernel_latency
,
egress_stats
.
avg_kernel_latency
,
egress_stats
.
max_kernel_latency
);
egress_stats
.
max_kernel_latency
);
...
@@ -278,7 +279,7 @@ static void print_histograms() {
...
@@ -278,7 +279,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
;
int
max_hist_val
;
uint64_t
*
histogram
;
uint64_t
*
histogram
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
measures_end
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
measures_end
);
...
@@ -307,7 +308,7 @@ static void print_histograms() {
...
@@ -307,7 +308,7 @@ static void print_histograms() {
if
(
histogram
[
j
])
if
(
histogram
[
j
])
max_hist_val
=
j
>
max_hist_val
?
j
:
max_hist_val
;
max_hist_val
=
j
>
max_hist_val
?
j
:
max_hist_val
;
}
else
if
(
tsn_task
==
RTT_TASK
)
{
}
else
{
printf
(
"{
\"
measure_sets
\"
: [{"
printf
(
"{
\"
measure_sets
\"
: [{"
"
\"
measure_type
\"
:
\"
packet_rtt
\"
,"
"
\"
measure_type
\"
:
\"
packet_rtt
\"
,"
"
\"
props_names
\"
: [
\"
rtt
\"
],"
"
\"
props_names
\"
: [
\"
rtt
\"
],"
...
@@ -329,7 +330,7 @@ static void print_histograms() {
...
@@ -329,7 +330,7 @@ static void print_histograms() {
printf
(
"["
);
printf
(
"["
);
for
(
int
j
=
0
;
j
<
max_hist_val
;
j
++
)
for
(
int
j
=
0
;
j
<
max_hist_val
;
j
++
)
printf
(
"%"
PRIi64
"%s"
,
histogram
[
j
],
(
j
+
1
<
max_hist_val
?
", "
:
""
));
printf
(
"%"
PRIi64
"%s"
,
histogram
[
j
],
(
j
+
1
<
max_hist_val
?
", "
:
""
));
printf
(
"
%s
]"
);
printf
(
"]"
);
printf
(
"]}]}
\n
"
);
printf
(
"]}]}
\n
"
);
}
}
...
...
packet-exchange/src/server.c
View file @
4982307e
...
@@ -48,8 +48,8 @@ static void sighand(int sig_num);
...
@@ -48,8 +48,8 @@ static void sighand(int sig_num);
// Static variables
// Static variables
static
int64_t
kernel_latency_hist
[
MAX_KERNEL_LATENCY
];
static
u
int64_t
kernel_latency_hist
[
MAX_KERNEL_LATENCY
];
static
int64_t
jitter_hist
[
MAX_JITTER
];
static
u
int64_t
jitter_hist
[
MAX_JITTER
];
static
main_param_t
main_params
;
static
main_param_t
main_params
;
static
thread_param_t
thread_params
;
static
thread_param_t
thread_params
;
...
@@ -87,6 +87,7 @@ static void help(char *argv[]) {
...
@@ -87,6 +87,7 @@ static void help(char *argv[]) {
// Real-time thread
// Real-time thread
// Measures intervals between packet receptions
// Measures intervals between packet receptions
static
void
*
packet_receiving_thread
(
void
*
p
)
{
static
void
*
packet_receiving_thread
(
void
*
p
)
{
(
void
)
p
;
struct
timespec
current
,
previous
;
struct
timespec
current
,
previous
;
struct
sched_param
priority
;
struct
sched_param
priority
;
cpu_set_t
mask
;
cpu_set_t
mask
;
...
@@ -189,8 +190,8 @@ int main(int argc, char *argv[]) {
...
@@ -189,8 +190,8 @@ int main(int argc, char *argv[]) {
if
(
enable_histograms
)
{
if
(
enable_histograms
)
{
// Init histograms
// Init histograms
memset
(
kernel_latency_hist
,
0
,
MAX_KERNEL_LATENCY
);
memset
(
kernel_latency_hist
,
0
,
sizeof
(
kernel_latency_hist
)
);
memset
(
jitter_hist
,
0
,
MAX_JITTER
);
memset
(
jitter_hist
,
0
,
sizeof
(
jitter_hist
)
);
}
}
// Catch breaks with sighand to print the histograms
// Catch breaks with sighand to print the histograms
...
@@ -223,7 +224,7 @@ int main(int argc, char *argv[]) {
...
@@ -223,7 +224,7 @@ int main(int argc, char *argv[]) {
int
jitter
=
ingress_stats
.
max_interval
-
ingress_stats
.
min_interval
;
int
jitter
=
ingress_stats
.
max_interval
-
ingress_stats
.
min_interval
;
printf
(
"%10
d
: J: %4d, I: %4d %4d %4d"
,
printf
(
"%10
"
PRIu64
"
: J: %4d, I: %4d %4d %4d"
,
ingress_stats
.
packets_received
,
ingress_stats
.
packets_received
,
jitter
,
jitter
,
ingress_stats
.
min_interval
,
ingress_stats
.
min_interval
,
...
@@ -253,7 +254,7 @@ static void print_histograms() {
...
@@ -253,7 +254,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_latency
,
m
in_latency
,
m
ax_jitter
,
min_jitter
;
int
max_latency
,
max_jitter
,
min_jitter
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
measures_end
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
measures_end
);
...
@@ -283,7 +284,7 @@ static void print_histograms() {
...
@@ -283,7 +284,7 @@ static void print_histograms() {
printf
(
"["
);
printf
(
"["
);
for
(
int
j
=
0
;
j
<
max_latency
;
j
++
)
for
(
int
j
=
0
;
j
<
max_latency
;
j
++
)
printf
(
"%"
PRIi64
"%s"
,
kernel_latency_hist
[
j
],
(
j
+
1
<
max_latency
?
", "
:
""
));
printf
(
"%"
PRIi64
"%s"
,
kernel_latency_hist
[
j
],
(
j
+
1
<
max_latency
?
", "
:
""
));
printf
(
"
%s
]"
);
printf
(
"]"
);
}
}
max_jitter
=
0
;
max_jitter
=
0
;
...
...
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