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
ca7e1790
Commit
ca7e1790
authored
Jun 11, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into measure-analysis
parents
356a4683
fd20bd9e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
55 deletions
+50
-55
packet-exchange/src/client.c
packet-exchange/src/client.c
+12
-15
packet-exchange/src/recv_packet.c
packet-exchange/src/recv_packet.c
+7
-10
packet-exchange/src/send_packet.c
packet-exchange/src/send_packet.c
+8
-10
packet-exchange/src/server.c
packet-exchange/src/server.c
+23
-20
No files found.
packet-exchange/src/client.c
View file @
ca7e1790
...
@@ -211,19 +211,16 @@ int main(int argc, char *argv[]) {
...
@@ -211,19 +211,16 @@ int main(int argc, char *argv[]) {
if
(
main_param
.
verbose
)
{
if
(
main_param
.
verbose
)
{
if
(
tsn_task
==
RTT_TASK
)
{
if
(
tsn_task
==
RTT_TASK
)
{
printf
(
"
RTT: %"
PRIu64
" (%d)
\n
"
,
stats
->
rtt
,
stats
->
nb_cycles
);
printf
(
"
%*d: RTT: %*"
PRIu64
"
\n
"
,
10
,
stats
->
nb_cycles
,
10
,
stats
->
rtt
);
printf
(
"
\033
[%dA"
,
1
);
}
else
if
(
enable_timestamps
)
{
}
else
if
(
enable_timestamps
)
{
printf
(
"(%d) Enter send_udp_packet timestamp: %"
PRIu64
"
\n
"
,
int64_t
user_space_time
=
stats
->
packet_info
.
userspace_exit_ts
-
stats
->
packet_info
.
userspace_enter_ts
;
stats
->
nb_cycles
,
int64_t
kernel_space_time
=
stats
->
packet_info
.
kernelspace_ts
-
stats
->
packet_info
.
userspace_exit_ts
;
stats
->
packet_info
.
userspace_enter_ts
);
printf
(
"(%d) Call sendmsg timestamp : %"
PRIu64
"
\n
"
,
printf
(
"%*d: U: %*"
PRIi64
", K: %*"
PRIi64
"
\n
"
,
stats
->
nb_cycles
,
10
,
stats
->
nb_cycles
,
10
,
user_space_time
,
10
,
kernel_space_time
);
stats
->
packet_info
.
userspace_exit_ts
);
printf
(
"
\033
[%dA"
,
1
);
printf
(
"(%d) Leave kernel timestamp : %"
PRIu64
"
\n
"
,
stats
->
nb_cycles
,
stats
->
packet_info
.
kernelspace_ts
);
}
}
}
}
...
@@ -263,10 +260,10 @@ static void do_tsn_task(struct thread_param *param, char *data, uint64_t next_tx
...
@@ -263,10 +260,10 @@ static void do_tsn_task(struct thread_param *param, char *data, uint64_t next_tx
if
(
enable_histograms
)
{
if
(
enable_histograms
)
{
rtt_us
=
param
->
stats
.
rtt
/
1000
;
rtt_us
=
param
->
stats
.
rtt
/
1000
;
if
(
rtt_us
>
MAX_HIST_VAL
)
{
if
(
rtt_us
>
MAX_HIST_VAL
)
fprintf
(
stderr
,
"RTT value higher than MAX_HIST_VAL : %d ( > %d)
\n
"
,
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
);
else
}
histograms
[
0
][
rtt_us
]
++
;
histograms
[
0
][
rtt_us
]
++
;
}
}
}
}
...
...
packet-exchange/src/recv_packet.c
View file @
ca7e1790
...
@@ -12,7 +12,6 @@
...
@@ -12,7 +12,6 @@
#include <net/if.h>
#include <net/if.h>
#include <netdb.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <poll.h>
#include <pthread.h>
#include <pthread.h>
#include <sched.h>
#include <sched.h>
#include <signal.h>
#include <signal.h>
...
@@ -173,16 +172,14 @@ static void fill_histograms(packet_info_t *packet_info, int64_t histograms[NB_HI
...
@@ -173,16 +172,14 @@ static void fill_histograms(packet_info_t *packet_info, int64_t histograms[NB_HI
user_space_time
/=
1000u
;
user_space_time
/=
1000u
;
kernel_space_time
/=
1000u
;
kernel_space_time
/=
1000u
;
if
(
user_space_time
>
MAX_HIST_VAL
)
{
if
(
user_space_time
>
MAX_HIST_VAL
)
fprintf
(
stderr
,
"user_space_time value too high: %"
PRIu64
"us
\n
"
,
user_space_time
);
fprintf
(
stderr
,
"user_space_time value too high: %"
PRIu64
"us
\n
"
,
user_space_time
);
exit
(
EXIT_FAILURE
);
else
}
if
(
kernel_space_time
>
MAX_HIST_VAL
)
{
fprintf
(
stderr
,
"kernel_space_time value too high: %"
PRIu64
"us
\n
"
,
kernel_space_time
);
exit
(
EXIT_FAILURE
);
}
histograms
[
0
][
user_space_time
]
++
;
histograms
[
0
][
user_space_time
]
++
;
if
(
kernel_space_time
>
MAX_HIST_VAL
)
fprintf
(
stderr
,
"kernel_space_time value too high: %"
PRIu64
"us
\n
"
,
kernel_space_time
);
else
histograms
[
1
][
kernel_space_time
]
++
;
histograms
[
1
][
kernel_space_time
]
++
;
}
}
...
...
packet-exchange/src/send_packet.c
View file @
ca7e1790
...
@@ -190,7 +190,7 @@ packet_info_t send_udp_packet(int use_etf, int use_timestamps,
...
@@ -190,7 +190,7 @@ packet_info_t send_udp_packet(int use_etf, int use_timestamps,
error
(
EXIT_FAILURE
,
errno
,
"sendmsg failed, ret value: %d
\n
"
,
sendmsgerr
);
error
(
EXIT_FAILURE
,
errno
,
"sendmsg failed, ret value: %d
\n
"
,
sendmsgerr
);
if
(
use_timestamps
)
{
if
(
use_timestamps
)
{
pollerr
=
poll
(
&
poll_fd
,
1
,
0
);
pollerr
=
poll
(
&
poll_fd
,
1
,
1
);
if
(
pollerr
>
0
)
if
(
pollerr
>
0
)
process_timestamps
(
&
packet_info
,
histograms
);
process_timestamps
(
&
packet_info
,
histograms
);
else
else
...
@@ -208,16 +208,14 @@ static void fill_histograms(packet_info_t *packet_info, int64_t histograms[NB_HI
...
@@ -208,16 +208,14 @@ static void fill_histograms(packet_info_t *packet_info, int64_t histograms[NB_HI
user_space_time
/=
1000u
;
user_space_time
/=
1000u
;
kernel_space_time
/=
1000u
;
kernel_space_time
/=
1000u
;
if
(
user_space_time
>
MAX_HIST_VAL
)
{
if
(
user_space_time
>
MAX_HIST_VAL
)
fprintf
(
stderr
,
"user_space_time value too high: %"
PRIu64
"us
\n
"
,
user_space_time
);
fprintf
(
stderr
,
"user_space_time value too high: %"
PRIu64
"us
\n
"
,
user_space_time
);
exit
(
EXIT_FAILURE
);
else
}
if
(
kernel_space_time
>
MAX_HIST_VAL
)
{
fprintf
(
stderr
,
"kernel_space_time value too high: %"
PRIu64
"us
\n
"
,
kernel_space_time
);
exit
(
EXIT_FAILURE
);
}
histograms
[
0
][
user_space_time
]
++
;
histograms
[
0
][
user_space_time
]
++
;
if
(
kernel_space_time
>
MAX_HIST_VAL
)
fprintf
(
stderr
,
"kernel_space_time value too high: %"
PRIu64
"us
\n
"
,
kernel_space_time
);
else
histograms
[
1
][
kernel_space_time
]
++
;
histograms
[
1
][
kernel_space_time
]
++
;
}
}
...
...
packet-exchange/src/server.c
View file @
ca7e1790
...
@@ -157,14 +157,13 @@ static void *packet_receiving_thread(void *p) {
...
@@ -157,14 +157,13 @@ static void *packet_receiving_thread(void *p) {
if
(
enable_histograms
)
{
if
(
enable_histograms
)
{
dist_to_interval
=
(((
int64_t
)
diff
)
-
param
->
interval
)
/
1000
;
dist_to_interval
=
(((
int64_t
)
diff
)
-
param
->
interval
)
/
1000
;
dist_to_interval
+=
MAX_HIST_VAL
/
2
;
dist_to_interval
+=
MAX_HIST_VAL
/
2
;
if
(
dist_to_interval
>
((
int
)
MAX_HIST_VAL
)
||
dist_to_interval
<
0
)
{
if
(
dist_to_interval
>
((
int
)
MAX_HIST_VAL
)
||
dist_to_interval
<
0
)
fprintf
(
stderr
,
"jitter higher than MAX_HIST_VAL: %"
PRIi64
"
\n
"
,
dist_to_interval
);
fprintf
(
stderr
,
"jitter higher than MAX_HIST_VAL: %"
PRIi64
"
\n
"
,
dist_to_interval
);
exit
(
EXIT_FAILURE
);
else
}
else
{
histograms
[
2
][
dist_to_interval
]
++
;
histograms
[
2
][
dist_to_interval
]
++
;
}
}
}
}
}
previous
=
current
;
previous
=
current
;
prev_packet_id
=
current_packet_id
;
prev_packet_id
=
current_packet_id
;
...
@@ -179,7 +178,6 @@ static void *packet_receiving_thread(void *p) {
...
@@ -179,7 +178,6 @@ static void *packet_receiving_thread(void *p) {
int
main
(
int
argc
,
char
*
argv
[])
{
int
main
(
int
argc
,
char
*
argv
[])
{
pthread_t
thread
;
pthread_t
thread
;
thread_stat_t
*
stats
;
thread_stat_t
*
stats
;
int64_t
diff
;
param
=
malloc
(
sizeof
(
thread_param_t
));
param
=
malloc
(
sizeof
(
thread_param_t
));
stats
=
&
param
->
stats
;
stats
=
&
param
->
stats
;
...
@@ -227,24 +225,29 @@ int main(int argc, char *argv[]) {
...
@@ -227,24 +225,29 @@ int main(int argc, char *argv[]) {
if
(
main_param
.
verbose
)
{
if
(
main_param
.
verbose
)
{
if
(
tsn_task
==
RECV_PACKET_TASK
)
{
if
(
tsn_task
==
RECV_PACKET_TASK
)
{
diff
=
((
int64_t
)
stats
->
max_interval
)
-
stats
->
min_interval
;
printf
(
"(%d) Jitter : %"
PRIi64
" [Packet data: %s] [Lost packets: %d]
\n
"
,
int64_t
jitter
=
((
int64_t
)
stats
->
max_interval
)
-
stats
->
min_interval
;
stats
->
packets_received
,
diff
,
printf
(
"%*d: J: %*"
PRIi64
,
stats
->
packet_info
.
data
,
10
,
stats
->
packets_received
,
stats
->
lost_packets
);
10
,
jitter
);
if
(
enable_timestamps
)
{
if
(
enable_timestamps
)
{
printf
(
"(%d) Enter send_udp_packet timestamp: %"
PRIu64
"
\n
"
,
stats
->
packets_received
,
int64_t
user_space_time
=
stats
->
packet_info
.
userspace_exit_ts
-
stats
->
packet_info
.
userspace_enter_ts
;
stats
->
packet_info
.
userspace_enter_ts
)
;
int64_t
kernel_space_time
=
stats
->
packet_info
.
kernelspace_ts
-
stats
->
packet_info
.
userspace_exit_ts
;
printf
(
"(%d) Call sendmsg timestamp : %"
PRIu64
"
\n
"
,
stats
->
packets_received
,
printf
(
", U: %*"
PRIi64
", K: %*"
PRIi64
", D: %*s, L: %*d
\n
"
,
stats
->
packet_info
.
userspace_exit_ts
);
10
,
user_space_time
,
printf
(
"(%d) Leave kernel timestamp : %"
PRIu64
"
\n
"
,
10
,
kernel_space_time
,
stats
->
packets_received
,
4
,
stats
->
packet_info
.
data
,
stats
->
packet_info
.
kernelspace_
ts
);
4
,
stats
->
lost_packe
ts
);
}
}
else
{
printf
(
"
\n
"
);
}
printf
(
"
\033
[%dA"
,
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