mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 16:41:25 +00:00
tracepoints: format documentation
Impact: documentation update Properly format Documentation/tracepoints.txt - it was full of overlong lines and other typographical problems. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
0dcf8fe5fe
commit
0a7ad64531
1 changed files with 45 additions and 38 deletions
|
@ -3,28 +3,30 @@
|
||||||
Mathieu Desnoyers
|
Mathieu Desnoyers
|
||||||
|
|
||||||
|
|
||||||
This document introduces Linux Kernel Tracepoints and their use. It provides
|
This document introduces Linux Kernel Tracepoints and their use. It
|
||||||
examples of how to insert tracepoints in the kernel and connect probe functions
|
provides examples of how to insert tracepoints in the kernel and
|
||||||
to them and provides some examples of probe functions.
|
connect probe functions to them and provides some examples of probe
|
||||||
|
functions.
|
||||||
|
|
||||||
|
|
||||||
* Purpose of tracepoints
|
* Purpose of tracepoints
|
||||||
|
|
||||||
A tracepoint placed in code provides a hook to call a function (probe) that you
|
A tracepoint placed in code provides a hook to call a function (probe)
|
||||||
can provide at runtime. A tracepoint can be "on" (a probe is connected to it) or
|
that you can provide at runtime. A tracepoint can be "on" (a probe is
|
||||||
"off" (no probe is attached). When a tracepoint is "off" it has no effect,
|
connected to it) or "off" (no probe is attached). When a tracepoint is
|
||||||
except for adding a tiny time penalty (checking a condition for a branch) and
|
"off" it has no effect, except for adding a tiny time penalty
|
||||||
space penalty (adding a few bytes for the function call at the end of the
|
(checking a condition for a branch) and space penalty (adding a few
|
||||||
instrumented function and adds a data structure in a separate section). When a
|
bytes for the function call at the end of the instrumented function
|
||||||
tracepoint is "on", the function you provide is called each time the tracepoint
|
and adds a data structure in a separate section). When a tracepoint
|
||||||
is executed, in the execution context of the caller. When the function provided
|
is "on", the function you provide is called each time the tracepoint
|
||||||
ends its execution, it returns to the caller (continuing from the tracepoint
|
is executed, in the execution context of the caller. When the function
|
||||||
site).
|
provided ends its execution, it returns to the caller (continuing from
|
||||||
|
the tracepoint site).
|
||||||
|
|
||||||
You can put tracepoints at important locations in the code. They are
|
You can put tracepoints at important locations in the code. They are
|
||||||
lightweight hooks that can pass an arbitrary number of parameters,
|
lightweight hooks that can pass an arbitrary number of parameters,
|
||||||
which prototypes are described in a tracepoint declaration placed in a header
|
which prototypes are described in a tracepoint declaration placed in a
|
||||||
file.
|
header file.
|
||||||
|
|
||||||
They can be used for tracing and performance accounting.
|
They can be used for tracing and performance accounting.
|
||||||
|
|
||||||
|
@ -63,36 +65,41 @@ Where :
|
||||||
- subsys_eventname is an identifier unique to your event
|
- subsys_eventname is an identifier unique to your event
|
||||||
- subsys is the name of your subsystem.
|
- subsys is the name of your subsystem.
|
||||||
- eventname is the name of the event to trace.
|
- eventname is the name of the event to trace.
|
||||||
- TPPTOTO(int firstarg, struct task_struct *p) is the prototype of the function
|
|
||||||
called by this tracepoint.
|
|
||||||
- TPARGS(firstarg, p) are the parameters names, same as found in the prototype.
|
|
||||||
|
|
||||||
Connecting a function (probe) to a tracepoint is done by providing a probe
|
- TPPTOTO(int firstarg, struct task_struct *p) is the prototype of the
|
||||||
(function to call) for the specific tracepoint through
|
function called by this tracepoint.
|
||||||
|
|
||||||
|
- TPARGS(firstarg, p) are the parameters names, same as found in the
|
||||||
|
prototype.
|
||||||
|
|
||||||
|
Connecting a function (probe) to a tracepoint is done by providing a
|
||||||
|
probe (function to call) for the specific tracepoint through
|
||||||
register_trace_subsys_eventname(). Removing a probe is done through
|
register_trace_subsys_eventname(). Removing a probe is done through
|
||||||
unregister_trace_subsys_eventname(); it will remove the probe.
|
unregister_trace_subsys_eventname(); it will remove the probe.
|
||||||
tracepoint_synchronize_unregister() must be called before the end of the module exit
|
|
||||||
function to make sure there is no caller left using the probe. This, and the
|
|
||||||
fact that preemption is disabled around the probe call, make sure that probe
|
|
||||||
removal and module unload are safe. See the "Probe example" section below for a
|
|
||||||
sample probe module.
|
|
||||||
|
|
||||||
The tracepoint mechanism supports inserting multiple instances of the same
|
tracepoint_synchronize_unregister() must be called before the end of
|
||||||
tracepoint, but a single definition must be made of a given tracepoint name over
|
the module exit function to make sure there is no caller left using
|
||||||
all the kernel to make sure no type conflict will occur. Name mangling of the
|
the probe. This, and the fact that preemption is disabled around the
|
||||||
tracepoints is done using the prototypes to make sure typing is correct.
|
probe call, make sure that probe removal and module unload are safe.
|
||||||
Verification of probe type correctness is done at the registration site by the
|
See the "Probe example" section below for a sample probe module.
|
||||||
compiler. Tracepoints can be put in inline functions, inlined static functions,
|
|
||||||
and unrolled loops as well as regular functions.
|
|
||||||
|
|
||||||
The naming scheme "subsys_event" is suggested here as a convention intended
|
The tracepoint mechanism supports inserting multiple instances of the
|
||||||
to limit collisions. Tracepoint names are global to the kernel: they are
|
same tracepoint, but a single definition must be made of a given
|
||||||
considered as being the same whether they are in the core kernel image or in
|
tracepoint name over all the kernel to make sure no type conflict will
|
||||||
modules.
|
occur. Name mangling of the tracepoints is done using the prototypes
|
||||||
|
to make sure typing is correct. Verification of probe type correctness
|
||||||
|
is done at the registration site by the compiler. Tracepoints can be
|
||||||
|
put in inline functions, inlined static functions, and unrolled loops
|
||||||
|
as well as regular functions.
|
||||||
|
|
||||||
|
The naming scheme "subsys_event" is suggested here as a convention
|
||||||
|
intended to limit collisions. Tracepoint names are global to the
|
||||||
|
kernel: they are considered as being the same whether they are in the
|
||||||
|
core kernel image or in modules.
|
||||||
|
|
||||||
If the tracepoint has to be used in kernel modules, an
|
If the tracepoint has to be used in kernel modules, an
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL() or EXPORT_TRACEPOINT_SYMBOL() can be used to
|
EXPORT_TRACEPOINT_SYMBOL_GPL() or EXPORT_TRACEPOINT_SYMBOL() can be
|
||||||
export the defined tracepoints.
|
used to export the defined tracepoints.
|
||||||
|
|
||||||
* Probe / tracepoint example
|
* Probe / tracepoint example
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue