diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-02-10 20:25:00 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-17 19:40:20 -0500 |
commit | 6eaaa5d57e76c454479833fc8594cd7c3b75c789 (patch) | |
tree | c8f3c130004199bbbc8d141bbfb0f216539c0724 /kernel/trace/trace.h | |
parent | ac07bcaa8259841905ead3f8cd60b1923ca6c0e5 (diff) |
tracing/core: use appropriate waiting on trace_pipe
Impact: api and pipe waiting change
Currently, the waiting used in tracing_read_pipe() is done through a
100 msecs schedule_timeout() loop which periodically check if there
are traces on the buffer.
This can cause small latencies for programs which are reading the incoming
events.
This patch makes the reader waiting for the trace_wait waitqueue except
for few tracers such as the sched and functions tracers which might be
already hold the runqueue lock while waking up the reader.
This is performed through a new callback wait_pipe() on struct tracer.
If none is implemented on a specific tracer, the default waiting for
trace_wait queue is attached.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r-- | kernel/trace/trace.h | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index dbff0207b213..eed732c151fc 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -337,18 +337,34 @@ struct tracer_flags { | |||
337 | #define TRACER_OPT(s, b) .name = #s, .bit = b | 337 | #define TRACER_OPT(s, b) .name = #s, .bit = b |
338 | 338 | ||
339 | 339 | ||
340 | /* | 340 | /** |
341 | * A specific tracer, represented by methods that operate on a trace array: | 341 | * struct tracer - a specific tracer and its callbacks to interact with debugfs |
342 | * @name: the name chosen to select it on the available_tracers file | ||
343 | * @init: called when one switches to this tracer (echo name > current_tracer) | ||
344 | * @reset: called when one switches to another tracer | ||
345 | * @start: called when tracing is unpaused (echo 1 > tracing_enabled) | ||
346 | * @stop: called when tracing is paused (echo 0 > tracing_enabled) | ||
347 | * @open: called when the trace file is opened | ||
348 | * @pipe_open: called when the trace_pipe file is opened | ||
349 | * @wait_pipe: override how the user waits for traces on trace_pipe | ||
350 | * @close: called when the trace file is released | ||
351 | * @read: override the default read callback on trace_pipe | ||
352 | * @splice_read: override the default splice_read callback on trace_pipe | ||
353 | * @selftest: selftest to run on boot (see trace_selftest.c) | ||
354 | * @print_headers: override the first lines that describe your columns | ||
355 | * @print_line: callback that prints a trace | ||
356 | * @set_flag: signals one of your private flags changed (trace_options file) | ||
357 | * @flags: your private flags | ||
342 | */ | 358 | */ |
343 | struct tracer { | 359 | struct tracer { |
344 | const char *name; | 360 | const char *name; |
345 | /* Your tracer should raise a warning if init fails */ | ||
346 | int (*init)(struct trace_array *tr); | 361 | int (*init)(struct trace_array *tr); |
347 | void (*reset)(struct trace_array *tr); | 362 | void (*reset)(struct trace_array *tr); |
348 | void (*start)(struct trace_array *tr); | 363 | void (*start)(struct trace_array *tr); |
349 | void (*stop)(struct trace_array *tr); | 364 | void (*stop)(struct trace_array *tr); |
350 | void (*open)(struct trace_iterator *iter); | 365 | void (*open)(struct trace_iterator *iter); |
351 | void (*pipe_open)(struct trace_iterator *iter); | 366 | void (*pipe_open)(struct trace_iterator *iter); |
367 | void (*wait_pipe)(struct trace_iterator *iter); | ||
352 | void (*close)(struct trace_iterator *iter); | 368 | void (*close)(struct trace_iterator *iter); |
353 | ssize_t (*read)(struct trace_iterator *iter, | 369 | ssize_t (*read)(struct trace_iterator *iter, |
354 | struct file *filp, char __user *ubuf, | 370 | struct file *filp, char __user *ubuf, |
@@ -432,6 +448,9 @@ void tracing_generic_entry_update(struct trace_entry *entry, | |||
432 | unsigned long flags, | 448 | unsigned long flags, |
433 | int pc); | 449 | int pc); |
434 | 450 | ||
451 | void default_wait_pipe(struct trace_iterator *iter); | ||
452 | void poll_wait_pipe(struct trace_iterator *iter); | ||
453 | |||
435 | void ftrace(struct trace_array *tr, | 454 | void ftrace(struct trace_array *tr, |
436 | struct trace_array_cpu *data, | 455 | struct trace_array_cpu *data, |
437 | unsigned long ip, | 456 | unsigned long ip, |