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
a94df26d
Commit
a94df26d
authored
Jun 04, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'packet-exchange' into measure-analysis
parents
660a9ae0
8b44c169
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
15 deletions
+46
-15
packet-exchange/build/Makefile
packet-exchange/build/Makefile
+5
-0
packet-exchange/src/client.c
packet-exchange/src/client.c
+41
-15
No files found.
packet-exchange/build/Makefile
View file @
a94df26d
...
@@ -18,7 +18,12 @@ CLIENT_SRCS += utilities.c
...
@@ -18,7 +18,12 @@ CLIENT_SRCS += utilities.c
SERVER_OBJS
=
$(SERVER_SRCS:%.c=%.o)
SERVER_OBJS
=
$(SERVER_SRCS:%.c=%.o)
CLIENT_OBJS
=
$(CLIENT_SRCS:%.c=%.o)
CLIENT_OBJS
=
$(CLIENT_SRCS:%.c=%.o)
ifeq
($(DEBUG),)
CFLAGS
=
-O2
-Wall
-Wextra
else
CFLAGS
=
-Og
-g
-Wall
-Wextra
CFLAGS
=
-Og
-g
-Wall
-Wextra
endif
CFLAGS
+=
-MD
-MP
CFLAGS
+=
-MD
-MP
CFLAGS
+=
-I
$(SRCDIR)
CFLAGS
+=
-I
$(SRCDIR)
CFLAGS
+=
-std
=
gnu99
CFLAGS
+=
-std
=
gnu99
...
...
packet-exchange/src/client.c
View file @
a94df26d
...
@@ -78,7 +78,7 @@ struct timespec measures_start;
...
@@ -78,7 +78,7 @@ struct timespec measures_start;
struct
timespec
measures_end
;
struct
timespec
measures_end
;
static
void
help
(
char
*
argv
[])
{
static
void
help
(
char
*
argv
[])
{
printf
(
"Usage: %s -f IF [-abethgv] [-d BUF_LEN] [-i USEC] [-l N] [-p PRIO] [-r USEC]
\n\n
"
,
argv
[
0
]);
printf
(
"Usage: %s -f IF [-abethgv] [-d BUF_LEN] [-i USEC] [-l N] [-p PRIO] [-
q PACKET_PRIO] [-
r USEC]
\n\n
"
,
argv
[
0
]);
printf
(
" -a Run the real time thread on CPU1
\n
"
);
printf
(
" -a Run the real time thread on CPU1
\n
"
);
printf
(
" -b Measure RTT
\n
"
);
printf
(
" -b Measure RTT
\n
"
);
printf
(
" -d BUF_LEN Set the length of tx buffer
\n
"
);
printf
(
" -d BUF_LEN Set the length of tx buffer
\n
"
);
...
@@ -89,6 +89,7 @@ static void help(char *argv[]) {
...
@@ -89,6 +89,7 @@ static void help(char *argv[]) {
printf
(
" -i USEC Wake up the real time thread every USEC microseconds (Default: 10ms)
\n
"
);
printf
(
" -i USEC Wake up the real time thread every USEC microseconds (Default: 10ms)
\n
"
);
printf
(
" -l N Wake up the real time thread N times (Default: 0)
\n
"
);
printf
(
" -l N Wake up the real time thread N times (Default: 0)
\n
"
);
printf
(
" -p PRIO Run the real time thread at priority PRIO
\n
"
);
printf
(
" -p PRIO Run the real time thread at priority PRIO
\n
"
);
printf
(
" -q PACKET_PRIO Send packets with PACKET_PRIO priority
\n
"
);
printf
(
" -r USEC Refresh the non real time main thread every USEC microseconds (Default: 50ms)
\n
"
);
printf
(
" -r USEC Refresh the non real time main thread every USEC microseconds (Default: 50ms)
\n
"
);
printf
(
" -t Enable timestamps
\n
"
);
printf
(
" -t Enable timestamps
\n
"
);
printf
(
" -v Verbose
\n
"
);
printf
(
" -v Verbose
\n
"
);
...
@@ -231,6 +232,7 @@ int main(int argc, char *argv[]) {
...
@@ -231,6 +232,7 @@ int main(int argc, char *argv[]) {
// Critical TSN task
// Critical TSN task
static
void
do_tsn_task
(
struct
thread_param
*
param
,
uint64_t
next_txtime
)
{
static
void
do_tsn_task
(
struct
thread_param
*
param
,
uint64_t
next_txtime
)
{
struct
timespec
t1
,
t2
;
struct
timespec
t1
,
t2
;
int
rtt_us
;
// One way packet sending
// One way packet sending
if
(
tsn_task
==
SEND_PACKET_TASK
)
{
if
(
tsn_task
==
SEND_PACKET_TASK
)
{
...
@@ -249,6 +251,15 @@ static void do_tsn_task(struct thread_param *param, uint64_t next_txtime) {
...
@@ -249,6 +251,15 @@ 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
)
{
rtt_us
=
param
->
stats
.
rtt
/
1000
;
if
(
rtt_us
>
MAX_HIST_VAL
)
{
fprintf
(
stderr
,
"RTT value higher than MAX_HIST_VAL : %d ( > %d)
\n
"
,
rtt_us
,
MAX_HIST_VAL
);
exit
(
EXIT_FAILURE
);
}
histograms
[
0
][
rtt_us
]
++
;
}
}
}
}
}
...
@@ -257,6 +268,7 @@ static void print_histograms() {
...
@@ -257,6 +268,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
);
...
@@ -266,6 +278,7 @@ static void print_histograms() {
...
@@ -266,6 +278,7 @@ static void print_histograms() {
interval
=
param
->
interval
/
1000
;
interval
=
param
->
interval
/
1000
;
if
(
tsn_task
==
SEND_PACKET_TASK
)
{
printf
(
"{
\"
measure_sets
\"
: [{"
printf
(
"{
\"
measure_sets
\"
: [{"
"
\"
measure_type
\"
:
\"
packet_send_timestamps
\"
,"
"
\"
measure_type
\"
:
\"
packet_send_timestamps
\"
,"
"
\"
props_names
\"
: [
\"
user_space
\"
,
\"
kernel_space
\"
],"
"
\"
props_names
\"
: [
\"
user_space
\"
,
\"
kernel_space
\"
],"
...
@@ -275,18 +288,31 @@ static void print_histograms() {
...
@@ -275,18 +288,31 @@ static void print_histograms() {
"
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
"
"
\"
i
\"
:
\"
%dus
\"
,
\"
duration
\"
:
\"
%dh%d
\"
"
"},"
"},"
"
\"
props
\"
: ["
,
interval
,
duration_hour
,
duration_minutes
);
"
\"
props
\"
: ["
,
interval
,
duration_hour
,
duration_minutes
);
}
else
if
(
tsn_task
==
RTT_TASK
)
{
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
;
int
max_hist_val
=
0
;
max_hist_val
=
0
;
for
(
int
i
=
0
;
i
<
2
;
i
++
)
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