Skip to content

Commit 90ddf2d

Browse files
committed
Merge tools/for-next
2 parents a9b72f4 + 05b7e10 commit 90ddf2d

26 files changed

+1395
-1711
lines changed

Documentation/tools/rtla/common_options.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,67 @@
5353
**--trace-buffer-size** *kB*
5454
Set the per-cpu trace buffer size in kB for the tracing output.
5555

56+
**--on-threshold** *action*
57+
58+
Defines an action to be executed when tracing is stopped on a latency threshold
59+
specified by |threshold|.
60+
61+
Multiple --on-threshold actions may be specified, and they will be executed in
62+
the order they are provided. If any action fails, subsequent actions in the list
63+
will not be executed.
64+
65+
Supported actions are:
66+
67+
- *trace[,file=<filename>]*
68+
69+
Saves trace output, optionally taking a filename. Alternative to -t/--trace.
70+
Note that nlike -t/--trace, specifying this multiple times will result in
71+
the trace being saved multiple times.
72+
73+
- *signal,num=<sig>,pid=<pid>*
74+
75+
Sends signal to process. "parent" might be specified in place of pid to target
76+
the parent process of rtla.
77+
78+
- *shell,command=<command>*
79+
80+
Execute shell command.
81+
82+
- *continue*
83+
84+
Continue tracing after actions are executed instead of stopping.
85+
86+
Example:
87+
88+
$ rtla |tool| |thresharg| 20 --on-threshold trace
89+
--on-threshold shell,command="grep ipi_send |tracer|\_trace.txt"
90+
--on-threshold signal,num=2,pid=parent
91+
92+
This will save a trace with the default filename "|tracer|\_trace.txt", print its
93+
lines that contain the text "ipi_send" on standard output, and send signal 2
94+
(SIGINT) to the parent process.
95+
96+
Performance Considerations:
97+
98+
|actionsperf|
99+
100+
**--on-end** *action*
101+
102+
Defines an action to be executed at the end of tracing.
103+
104+
Multiple --on-end actions can be specified, and they will be executed in the order
105+
they are provided. If any action fails, subsequent actions in the list will not be
106+
executed.
107+
108+
See the documentation for **--on-threshold** for the list of supported actions, with
109+
the exception that *continue* has no effect.
110+
111+
Example:
112+
113+
$ rtla |tool| -d 5s --on-end trace
114+
115+
This runs rtla with the default options, and saves trace output at the end.
116+
56117
**-h**, **--help**
57118

58119
Print help menu.

Documentation/tools/rtla/common_osnoise_options.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
.. |threshold| replace:: **-a/--auto**, **-s/--stop**, or **-S/--stop-total**
2+
.. |thresharg| replace:: -s
3+
.. |tracer| replace:: osnoise
4+
5+
.. |actionsperf| replace::
6+
Due to implementational limitations, actions might be delayed
7+
up to one second after tracing is stopped.
8+
19
**-a**, **--auto** *us*
210

311
Set the automatic trace mode. This mode sets some commonly used options
Lines changed: 10 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
.. |threshold| replace:: **-a/--auto**, **-i/--irq**, or **-T/--thread**
2+
.. |thresharg| replace:: -T
3+
.. |tracer| replace:: timerlat
4+
5+
.. |actionsperf| replace::
6+
For time-sensitive actions, it is recommended to run **rtla timerlat** with BPF
7+
support and RT priority. Note that due to implementational limitations, actions
8+
might be delayed up to one second after tracing is stopped if BPF mode is not
9+
available or disabled.
10+
111
**-a**, **--auto** *us*
212

313
Set the automatic trace mode. This mode sets some commonly used options
@@ -55,67 +65,3 @@
5565
Set timerlat to run without workload, waiting for the user to dispatch a per-cpu
5666
task that waits for a new period on the tracing/osnoise/per_cpu/cpu$ID/timerlat_fd.
5767
See linux/tools/rtla/sample/timerlat_load.py for an example of user-load code.
58-
59-
**--on-threshold** *action*
60-
61-
Defines an action to be executed when tracing is stopped on a latency threshold
62-
specified by **-i/--irq** or **-T/--thread**.
63-
64-
Multiple --on-threshold actions may be specified, and they will be executed in
65-
the order they are provided. If any action fails, subsequent actions in the list
66-
will not be executed.
67-
68-
Supported actions are:
69-
70-
- *trace[,file=<filename>]*
71-
72-
Saves trace output, optionally taking a filename. Alternative to -t/--trace.
73-
Note that nlike -t/--trace, specifying this multiple times will result in
74-
the trace being saved multiple times.
75-
76-
- *signal,num=<sig>,pid=<pid>*
77-
78-
Sends signal to process. "parent" might be specified in place of pid to target
79-
the parent process of rtla.
80-
81-
- *shell,command=<command>*
82-
83-
Execute shell command.
84-
85-
- *continue*
86-
87-
Continue tracing after actions are executed instead of stopping.
88-
89-
Example:
90-
91-
$ rtla timerlat -T 20 --on-threshold trace
92-
--on-threshold shell,command="grep ipi_send timerlat_trace.txt"
93-
--on-threshold signal,num=2,pid=parent
94-
95-
This will save a trace with the default filename "timerlat_trace.txt", print its
96-
lines that contain the text "ipi_send" on standard output, and send signal 2
97-
(SIGINT) to the parent process.
98-
99-
Performance Considerations:
100-
101-
For time-sensitive actions, it is recommended to run **rtla timerlat** with BPF
102-
support and RT priority. Note that due to implementational limitations, actions
103-
might be delayed up to one second after tracing is stopped if BPF mode is not
104-
available or disabled.
105-
106-
**--on-end** *action*
107-
108-
Defines an action to be executed at the end of **rtla timerlat** tracing.
109-
110-
Multiple --on-end actions can be specified, and they will be executed in the order
111-
they are provided. If any action fails, subsequent actions in the list will not be
112-
executed.
113-
114-
See the documentation for **--on-threshold** for the list of supported actions, with
115-
the exception that *continue* has no effect.
116-
117-
Example:
118-
119-
$ rtla timerlat -d 5s --on-end trace
120-
121-
This runs rtla timerlat with default options and save trace output at the end.

Documentation/tools/rtla/rtla-hwnoise.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.. SPDX-License-Identifier: GPL-2.0
22
3+
.. |tool| replace:: hwnoise
4+
35
============
46
rtla-hwnoise
57
============

Documentation/tools/rtla/rtla-osnoise-hist.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. |tool| replace:: osnoise hist
2+
13
===================
24
rtla-osnoise-hist
35
===================

Documentation/tools/rtla/rtla-osnoise-top.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. |tool| replace:: osnoise top
2+
13
===================
24
rtla-osnoise-top
35
===================

Documentation/tools/rtla/rtla-timerlat-hist.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. |tool| replace:: timerlat hist
2+
13
=====================
24
rtla-timerlat-hist
35
=====================

Documentation/tools/rtla/rtla-timerlat-top.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. |tool| replace:: timerlat top
2+
13
====================
24
rtla-timerlat-top
35
====================

tools/tracing/rtla/src/Build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
rtla-y += trace.o
22
rtla-y += utils.o
33
rtla-y += actions.o
4+
rtla-y += common.o
45
rtla-y += osnoise.o
56
rtla-y += osnoise_top.o
67
rtla-y += osnoise_hist.o

tools/tracing/rtla/src/actions.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,17 @@ actions_add_continue(struct actions *self)
127127
* actions_parse - add an action based on text specification
128128
*/
129129
int
130-
actions_parse(struct actions *self, const char *trigger)
130+
actions_parse(struct actions *self, const char *trigger, const char *tracefn)
131131
{
132132
enum action_type type = ACTION_NONE;
133-
char *token;
133+
const char *token;
134134
char trigger_c[strlen(trigger)];
135135

136136
/* For ACTION_SIGNAL */
137137
int signal = 0, pid = 0;
138138

139139
/* For ACTION_TRACE_OUTPUT */
140-
char *trace_output;
140+
const char *trace_output;
141141

142142
strcpy(trigger_c, trigger);
143143
token = strtok(trigger_c, ",");
@@ -160,7 +160,7 @@ actions_parse(struct actions *self, const char *trigger)
160160
case ACTION_TRACE_OUTPUT:
161161
/* Takes no argument */
162162
if (token == NULL)
163-
trace_output = "timerlat_trace.txt";
163+
trace_output = tracefn;
164164
else {
165165
if (strlen(token) > 5 && strncmp(token, "file=", 5) == 0) {
166166
trace_output = token + 5;

0 commit comments

Comments
 (0)