diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-11-16 02:54:36 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-16 03:01:38 -0500 |
commit | 0a7ad64531713e33e39af95bdbfb172f4f328b1e (patch) | |
tree | 29422c9de877316e016d5aee61d19a1cbbce667e /Documentation | |
parent | 0dcf8fe5fe5d7279f1c479fa82f1f1ca6f22e814 (diff) |
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>
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/tracepoints.txt | 87 |
1 files changed, 47 insertions, 40 deletions
diff --git a/Documentation/tracepoints.txt b/Documentation/tracepoints.txt index 3a1c74384ffb..2d42241a25c3 100644 --- a/Documentation/tracepoints.txt +++ b/Documentation/tracepoints.txt | |||
@@ -3,28 +3,30 @@ | |||
3 | Mathieu Desnoyers | 3 | Mathieu Desnoyers |
4 | 4 | ||
5 | 5 | ||
6 | This document introduces Linux Kernel Tracepoints and their use. It provides | 6 | This document introduces Linux Kernel Tracepoints and their use. It |
7 | examples of how to insert tracepoints in the kernel and connect probe functions | 7 | provides examples of how to insert tracepoints in the kernel and |
8 | to them and provides some examples of probe functions. | 8 | connect probe functions to them and provides some examples of probe |
9 | functions. | ||
9 | 10 | ||
10 | 11 | ||
11 | * Purpose of tracepoints | 12 | * Purpose of tracepoints |
12 | 13 | ||
13 | A tracepoint placed in code provides a hook to call a function (probe) that you | 14 | A tracepoint placed in code provides a hook to call a function (probe) |
14 | can provide at runtime. A tracepoint can be "on" (a probe is connected to it) or | 15 | that you can provide at runtime. A tracepoint can be "on" (a probe is |
15 | "off" (no probe is attached). When a tracepoint is "off" it has no effect, | 16 | connected to it) or "off" (no probe is attached). When a tracepoint is |
16 | except for adding a tiny time penalty (checking a condition for a branch) and | 17 | "off" it has no effect, except for adding a tiny time penalty |
17 | space penalty (adding a few bytes for the function call at the end of the | 18 | (checking a condition for a branch) and space penalty (adding a few |
18 | instrumented function and adds a data structure in a separate section). When a | 19 | bytes for the function call at the end of the instrumented function |
19 | tracepoint is "on", the function you provide is called each time the tracepoint | 20 | and adds a data structure in a separate section). When a tracepoint |
20 | is executed, in the execution context of the caller. When the function provided | 21 | is "on", the function you provide is called each time the tracepoint |
21 | ends its execution, it returns to the caller (continuing from the tracepoint | 22 | is executed, in the execution context of the caller. When the function |
22 | site). | 23 | provided ends its execution, it returns to the caller (continuing from |
24 | the tracepoint site). | ||
23 | 25 | ||
24 | You can put tracepoints at important locations in the code. They are | 26 | You can put tracepoints at important locations in the code. They are |
25 | lightweight hooks that can pass an arbitrary number of parameters, | 27 | lightweight hooks that can pass an arbitrary number of parameters, |
26 | which prototypes are described in a tracepoint declaration placed in a header | 28 | which prototypes are described in a tracepoint declaration placed in a |
27 | file. | 29 | header file. |
28 | 30 | ||
29 | They can be used for tracing and performance accounting. | 31 | They can be used for tracing and performance accounting. |
30 | 32 | ||
@@ -63,36 +65,41 @@ Where : | |||
63 | - subsys_eventname is an identifier unique to your event | 65 | - subsys_eventname is an identifier unique to your event |
64 | - subsys is the name of your subsystem. | 66 | - subsys is the name of your subsystem. |
65 | - eventname is the name of the event to trace. | 67 | - eventname is the name of the event to trace. |
66 | - TPPTOTO(int firstarg, struct task_struct *p) is the prototype of the function | ||
67 | called by this tracepoint. | ||
68 | - TPARGS(firstarg, p) are the parameters names, same as found in the prototype. | ||
69 | 68 | ||
70 | Connecting a function (probe) to a tracepoint is done by providing a probe | 69 | - TPPTOTO(int firstarg, struct task_struct *p) is the prototype of the |
71 | (function to call) for the specific tracepoint through | 70 | function called by this tracepoint. |
71 | |||
72 | - TPARGS(firstarg, p) are the parameters names, same as found in the | ||
73 | prototype. | ||
74 | |||
75 | Connecting a function (probe) to a tracepoint is done by providing a | ||
76 | probe (function to call) for the specific tracepoint through | ||
72 | register_trace_subsys_eventname(). Removing a probe is done through | 77 | register_trace_subsys_eventname(). Removing a probe is done through |
73 | unregister_trace_subsys_eventname(); it will remove the probe. | 78 | unregister_trace_subsys_eventname(); it will remove the probe. |
74 | tracepoint_synchronize_unregister() must be called before the end of the module exit | 79 | |
75 | function to make sure there is no caller left using the probe. This, and the | 80 | tracepoint_synchronize_unregister() must be called before the end of |
76 | fact that preemption is disabled around the probe call, make sure that probe | 81 | the module exit function to make sure there is no caller left using |
77 | removal and module unload are safe. See the "Probe example" section below for a | 82 | the probe. This, and the fact that preemption is disabled around the |
78 | sample probe module. | 83 | probe call, make sure that probe removal and module unload are safe. |
79 | 84 | See the "Probe example" section below for a sample probe module. | |
80 | The tracepoint mechanism supports inserting multiple instances of the same | 85 | |
81 | tracepoint, but a single definition must be made of a given tracepoint name over | 86 | The tracepoint mechanism supports inserting multiple instances of the |
82 | all the kernel to make sure no type conflict will occur. Name mangling of the | 87 | same tracepoint, but a single definition must be made of a given |
83 | tracepoints is done using the prototypes to make sure typing is correct. | 88 | tracepoint name over all the kernel to make sure no type conflict will |
84 | Verification of probe type correctness is done at the registration site by the | 89 | occur. Name mangling of the tracepoints is done using the prototypes |
85 | compiler. Tracepoints can be put in inline functions, inlined static functions, | 90 | to make sure typing is correct. Verification of probe type correctness |
86 | and unrolled loops as well as regular functions. | 91 | is done at the registration site by the compiler. Tracepoints can be |
87 | 92 | put in inline functions, inlined static functions, and unrolled loops | |
88 | The naming scheme "subsys_event" is suggested here as a convention intended | 93 | as well as regular functions. |
89 | to limit collisions. Tracepoint names are global to the kernel: they are | 94 | |
90 | considered as being the same whether they are in the core kernel image or in | 95 | The naming scheme "subsys_event" is suggested here as a convention |
91 | modules. | 96 | intended to limit collisions. Tracepoint names are global to the |
97 | kernel: they are considered as being the same whether they are in the | ||
98 | core kernel image or in modules. | ||
92 | 99 | ||
93 | If the tracepoint has to be used in kernel modules, an | 100 | If the tracepoint has to be used in kernel modules, an |
94 | EXPORT_TRACEPOINT_SYMBOL_GPL() or EXPORT_TRACEPOINT_SYMBOL() can be used to | 101 | EXPORT_TRACEPOINT_SYMBOL_GPL() or EXPORT_TRACEPOINT_SYMBOL() can be |
95 | export the defined tracepoints. | 102 | used to export the defined tracepoints. |
96 | 103 | ||
97 | * Probe / tracepoint example | 104 | * Probe / tracepoint example |
98 | 105 | ||