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
b065e1ea
Commit
b065e1ea
authored
Sep 02, 2020
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to trace until threshold is met in client
parent
0594ac5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
5 deletions
+34
-5
packet-exchange/src/client.c
packet-exchange/src/client.c
+27
-3
scripts/run-client
scripts/run-client
+7
-2
No files found.
packet-exchange/src/client.c
View file @
b065e1ea
...
@@ -45,6 +45,10 @@ typedef struct thread_param {
...
@@ -45,6 +45,10 @@ typedef struct thread_param {
int
affinity_cpu
;
int
affinity_cpu
;
uint64_t
start_ts
;
uint64_t
start_ts
;
int
enable_etf_tracing
;
int
enable_threshold_tracing
;
int
threshold
;
}
thread_param_t
;
}
thread_param_t
;
typedef
struct
main_param
{
typedef
struct
main_param
{
...
@@ -104,6 +108,7 @@ static void help(char *argv[]) {
...
@@ -104,6 +108,7 @@ static void help(char *argv[]) {
" -t Enable TX timestamps
\n
"
" -t Enable TX timestamps
\n
"
" -v Verbose
\n
"
" -v Verbose
\n
"
" -T Enable tracing until deadline is missed
\n
"
" -T Enable tracing until deadline is missed
\n
"
" -S Enable tracing until threshold is reached
\n
"
"
\n
"
,
"
\n
"
,
argv
[
0
]);
argv
[
0
]);
}
}
...
@@ -184,6 +189,17 @@ static void *packet_sending_thread(void *p) {
...
@@ -184,6 +189,17 @@ static void *packet_sending_thread(void *p) {
egress_stats
.
avg_interval
=
egress_stats
.
avg_interval
=
(
egress_stats
.
avg_interval
*
nb_cycles
+
interval_us
)
/
(
egress_stats
.
avg_interval
*
nb_cycles
+
interval_us
)
/
(
nb_cycles
+
1
);
(
nb_cycles
+
1
);
if
(
thread_params
.
enable_threshold_tracing
)
{
int
jitter
=
(
egress_stats
.
max_interval
-
egress_stats
.
min_interval
);
if
(
jitter
>
thread_params
.
threshold
)
{
tracemark
(
"Threshold reached
\n
"
);
tracing
(
0
);
printf
(
"Threshold reached: %dus
\n
"
,
jitter
);
printf
(
"Exiting packet-exchange...
\n
"
,
jitter
);
exit
(
EXIT_SUCCESS
);
}
}
}
}
previous
=
current
;
previous
=
current
;
...
@@ -216,6 +232,8 @@ int main(int argc, char *argv[]) {
...
@@ -216,6 +232,8 @@ int main(int argc, char *argv[]) {
thread_params
.
send_tx_delay
=
0
;
thread_params
.
send_tx_delay
=
0
;
thread_params
.
affinity_cpu
=
-
1
;
thread_params
.
affinity_cpu
=
-
1
;
thread_params
.
start_ts
=
0
;
thread_params
.
start_ts
=
0
;
thread_params
.
enable_etf_tracing
=
0
;
thread_params
.
enable_threshold_tracing
=
0
;
main_params
.
refresh_rate
=
50000
;
main_params
.
refresh_rate
=
50000
;
main_params
.
verbose
=
0
;
main_params
.
verbose
=
0
;
main_params
.
enable_tracing
=
0
;
main_params
.
enable_tracing
=
0
;
...
@@ -247,7 +265,7 @@ int main(int argc, char *argv[]) {
...
@@ -247,7 +265,7 @@ int main(int argc, char *argv[]) {
}
}
if
(
main_params
.
enable_tracing
)
{
if
(
main_params
.
enable_tracing
)
{
//
Enable ftrace
//
Open tracing file descriptors
open_fds
();
open_fds
();
}
}
...
@@ -256,7 +274,7 @@ int main(int argc, char *argv[]) {
...
@@ -256,7 +274,7 @@ int main(int argc, char *argv[]) {
// Initialize the UDP packet sending socket
// Initialize the UDP packet sending socket
init_udp_send
(
&
egress_params
,
&
egress_stats
,
enable_histograms
,
init_udp_send
(
&
egress_params
,
&
egress_stats
,
enable_histograms
,
main_params
.
enable
_tracing
,
kernel_latency_hist
);
thread_params
.
enable_etf
_tracing
,
kernel_latency_hist
);
// Initialize the UDP packet receiving socket if RTT is measured
// Initialize the UDP packet receiving socket if RTT is measured
if
(
tsn_task
==
RTT_TASK
)
if
(
tsn_task
==
RTT_TASK
)
...
@@ -415,7 +433,7 @@ static void sighand(int sig_num) {
...
@@ -415,7 +433,7 @@ static void sighand(int sig_num) {
*/
*/
static
void
process_options
(
int
argc
,
char
*
argv
[])
{
static
void
process_options
(
int
argc
,
char
*
argv
[])
{
for
(;;)
{
for
(;;)
{
int
c
=
getopt
(
argc
,
argv
,
"a:bc:d:e:ghi:l:p:q:r:s:tvT"
);
int
c
=
getopt
(
argc
,
argv
,
"a:bc:d:e:ghi:l:p:q:r:s:tvT
S:
"
);
if
(
c
==
-
1
)
break
;
if
(
c
==
-
1
)
break
;
...
@@ -473,6 +491,12 @@ static void process_options(int argc, char *argv[]) {
...
@@ -473,6 +491,12 @@ static void process_options(int argc, char *argv[]) {
break
;
break
;
case
'T'
:
case
'T'
:
main_params
.
enable_tracing
=
1
;
main_params
.
enable_tracing
=
1
;
thread_params
.
enable_etf_tracing
=
1
;
break
;
case
'S'
:
main_params
.
enable_tracing
=
1
;
thread_params
.
enable_threshold_tracing
=
1
;
thread_params
.
threshold
=
atoi
(
optarg
);
break
;
break
;
}
}
}
}
...
...
scripts/run-client
View file @
b065e1ea
...
@@ -30,7 +30,8 @@ Usage: $0 [-h] QDISC_OPT [CLIENT_OPTS] BOARD_HOSTNAME
...
@@ -30,7 +30,8 @@ Usage: $0 [-h] QDISC_OPT [CLIENT_OPTS] BOARD_HOSTNAME
TRACE_OPTS: -T [-P TRACER -E EVENTS -B SIZE]
TRACE_OPTS: -T [-P TRACER -E EVENTS -B SIZE]
Options to trace with trace-cmd until ETF deadline is missed
Options to trace with trace-cmd until ETF deadline is missed
(see trace-cmd man page and ftrace documentation)
(see trace-cmd man page and ftrace documentation)
-T Enable tracing
-T Enable ETF tracing
-S THRESHOLD Enable threshold tracing
-P TRACER Which trace to use when tracing: function, function_graph, wakeup etc...
-P TRACER Which trace to use when tracing: function, function_graph, wakeup etc...
Default: function
Default: function
-E EVENTS Specify which events to trace (e.g: "-E "-e net -e irq")
-E EVENTS Specify which events to trace (e.g: "-E "-e net -e irq")
...
@@ -56,7 +57,7 @@ etf_offset=500
...
@@ -56,7 +57,7 @@ etf_offset=500
tracecmd_events
=
"-e irq -e sched -e net_dev_start_xmit -e net_dev_xmit -e net_dev_xmit_timeout"
tracecmd_events
=
"-e irq -e sched -e net_dev_start_xmit -e net_dev_xmit -e net_dev_xmit_timeout"
tracecmd_opts
=
""
tracecmd_opts
=
""
while
getopts
"a:bc:d:e:o:ghi:pqs:tB:E:I:HP:T"
opt
;
do
while
getopts
"a:bc:d:e:o:ghi:pqs:tB:E:I:HP:T
S:
"
opt
;
do
case
"
${
opt
}
"
in
case
"
${
opt
}
"
in
a
)
a
)
cpu
=
${
OPTARG
}
cpu
=
${
OPTARG
}
...
@@ -123,6 +124,10 @@ while getopts "a:bc:d:e:o:ghi:pqs:tB:E:I:HP:T" opt; do
...
@@ -123,6 +124,10 @@ while getopts "a:bc:d:e:o:ghi:pqs:tB:E:I:HP:T" opt; do
use_tracer
=
1
use_tracer
=
1
client_options+
=
" -T"
client_options+
=
" -T"
;;
;;
S
)
use_tracer
=
1
client_options+
=
" -S
${
OPTARG
}
"
;;
*
)
*
)
usage
usage
;;
;;
...
...
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