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
f4b2d16c
Commit
f4b2d16c
authored
Jun 09, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix timestamps for etf queue
parent
b863db00
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
packet-exchange/src/client.c
packet-exchange/src/client.c
+18
-10
No files found.
packet-exchange/src/client.c
View file @
f4b2d16c
...
...
@@ -34,6 +34,7 @@ typedef struct thread_param {
int
interval
;
int
max_cycles
;
int
priority
;
int
etf_offset
;
thread_stat_t
stats
;
}
thread_param_t
;
...
...
@@ -78,11 +79,11 @@ struct timespec measures_start;
struct
timespec
measures_end
;
static
void
help
(
char
*
argv
[])
{
printf
(
"Usage: %s -f IF [-ab
ethgv
] [-d BUF_LEN] [-i USEC] [-l N] [-p PRIO] [-q PACKET_PRIO] [-r USEC]
\n\n
"
,
argv
[
0
]);
printf
(
"Usage: %s -f IF [-ab
thgv] [-e ETF_OFFSET
] [-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
(
" -b Measure RTT
\n
"
);
printf
(
" -d BUF_LEN Set the length of tx buffer
\n
"
);
printf
(
" -e
Set a txtime
(to be used in an ETF qdisc)
\n
"
);
printf
(
" -e
ETF_OFFSET Set a txtime with an offset of ETF_OFFSET us
(to be used in an ETF qdisc)
\n
"
);
printf
(
" -f IF Set the network interface to be used
\n
"
);
printf
(
" -g Print histograms to sdtout on exit
\n
"
);
printf
(
" -h Show help
\n
"
);
...
...
@@ -119,13 +120,17 @@ static void *packet_sending_thread(void *p) {
if
(
sched_setscheduler
(
0
,
SCHED_FIFO
,
&
priority
))
error
(
EXIT_FAILURE
,
errno
,
"Couldn't set priority"
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
next
);
next_txtime
=
next
.
tv_sec
*
NSEC_PER_SEC
+
next
.
tv_nsec
;
// Wait around 1 second
next_txtime
+=
(
1
*
NSEC_PER_SEC
/
param
->
interval
)
*
param
->
interval
;
// Send packet while thread is sleeping
next_txtime
+=
(
param
->
interval
)
/
2
;
if
(
enable_etf
)
{
// Measure from CLOCK_TAI to generate timestamp
clock_gettime
(
CLOCK_TAI
,
&
next
);
next_txtime
=
next
.
tv_sec
*
NSEC_PER_SEC
+
next
.
tv_nsec
;
next_txtime
+=
param
->
etf_offset
;
}
else
{
next_txtime
=
0
;
}
clock_gettime
(
CLOCK_MONOTONIC
,
&
next
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
measures_start
);
// Packet sending loop
for
(
stats
->
nb_cycles
=
0
;;
stats
->
nb_cycles
++
)
{
...
...
@@ -136,7 +141,9 @@ static void *packet_sending_thread(void *p) {
do_tsn_task
(
param
,
next_txtime
);
add_ns
(
&
next
,
param
->
interval
);
next_txtime
+=
(
param
->
interval
);
if
(
enable_etf
)
next_txtime
+=
param
->
interval
;
clock_nanosleep
(
CLOCK_MONOTONIC
,
TIMER_ABSTIME
,
&
next
,
NULL
);
}
...
...
@@ -331,7 +338,7 @@ static void process_options(int argc, char *argv[]) {
int
network_if_specified
=
0
;
for
(;;)
{
int
c
=
getopt
(
argc
,
argv
,
"abd:ef:ghi:l:p:q:r:tv"
);
int
c
=
getopt
(
argc
,
argv
,
"abd:e
:
f:ghi:l:p:q:r:tv"
);
if
(
c
==
-
1
)
break
;
...
...
@@ -352,6 +359,7 @@ static void process_options(int argc, char *argv[]) {
break
;
case
'e'
:
enable_etf
=
1
;
param
->
etf_offset
=
atoi
(
optarg
)
*
1000
;
break
;
case
'f'
:
network_if_specified
=
1
;
...
...
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