diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2008-11-17 13:23:42 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-11-18 05:10:58 -0500 |
commit | adf9f19574334c9a29a2bc956009fcac7edf1a6b (patch) | |
tree | 644415fb8e460290a6747c5933a1c62be9a9d50f /kernel/trace/trace.h | |
parent | 5a209c2d58e70f9bc415b9cdf0e3b9aaefb70371 (diff) |
tracing/ftrace: implement a set_flag callback for tracers
Impact: give a way to send specific messages to tracers
The current implementation of tracing uses some flags to control the
output of general tracers. But we have no way to implement custom
flags handling for a specific tracer. This patch proposes a new
callback for the struct tracer which called set_flag and a structure
that represents a 32 bits variable flag.
A tracer can implement a struct tracer_flags on which it puts the
initial value of the flag integer. Than it can place a range of flags
with their name and their flag mask on the flag integer. The structure
that implement a single flag is called struct tracer_opt.
These custom flags will be available through the trace_options file
like the general tracing flags. Changing their value is done like the
other general flags. For example if you have a flag that calls "foo",
you can activate it by writing "foo" or "nofoo" on trace_options.
Note that the set_flag callback is optional and is only needed if you
want the flags changing to be signaled to your tracer and let it to
accept or refuse their assignment.
V2: Some arrangements in coding style....
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r-- | kernel/trace/trace.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 37947f6b92bf..9d22618bf99f 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -259,6 +259,29 @@ enum print_line_t { | |||
259 | TRACE_TYPE_UNHANDLED = 2 /* Relay to other output functions */ | 259 | TRACE_TYPE_UNHANDLED = 2 /* Relay to other output functions */ |
260 | }; | 260 | }; |
261 | 261 | ||
262 | |||
263 | /* | ||
264 | * An option specific to a tracer. This is a boolean value. | ||
265 | * The bit is the bit index that sets its value on the | ||
266 | * flags value in struct tracer_flags. | ||
267 | */ | ||
268 | struct tracer_opt { | ||
269 | const char *name; /* Will appear on the trace_options file */ | ||
270 | u32 bit; /* Mask assigned in val field in tracer_flags */ | ||
271 | }; | ||
272 | |||
273 | /* | ||
274 | * The set of specific options for a tracer. Your tracer | ||
275 | * have to set the initial value of the flags val. | ||
276 | */ | ||
277 | struct tracer_flags { | ||
278 | u32 val; | ||
279 | struct tracer_opt *opts; | ||
280 | }; | ||
281 | |||
282 | /* Makes more easy to define a tracer opt */ | ||
283 | #define TRACER_OPT(s, b) .name = #s, .bit = b | ||
284 | |||
262 | /* | 285 | /* |
263 | * A specific tracer, represented by methods that operate on a trace array: | 286 | * A specific tracer, represented by methods that operate on a trace array: |
264 | */ | 287 | */ |
@@ -280,8 +303,11 @@ struct tracer { | |||
280 | struct trace_array *tr); | 303 | struct trace_array *tr); |
281 | #endif | 304 | #endif |
282 | enum print_line_t (*print_line)(struct trace_iterator *iter); | 305 | enum print_line_t (*print_line)(struct trace_iterator *iter); |
306 | /* If you handled the flag setting, return 0 */ | ||
307 | int (*set_flag)(u32 old_flags, u32 bit, int set); | ||
283 | struct tracer *next; | 308 | struct tracer *next; |
284 | int print_max; | 309 | int print_max; |
310 | struct tracer_flags *flags; | ||
285 | }; | 311 | }; |
286 | 312 | ||
287 | struct trace_seq { | 313 | struct trace_seq { |