aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-03-05 10:35:56 -0500
committerSteven Rostedt <srostedt@redhat.com>2009-03-05 10:35:56 -0500
commit2002c258faaa8f89543df284fdbaa9e4b171547f (patch)
tree225ad21ef3714638d67136db5a5cfc399d81c133 /include/linux
parent526211bc58c4b3265352801c5a7f469af5c34711 (diff)
tracing: add tracing_on/tracing_off to kernel.h
Impact: cleanup The functions tracing_start/tracing_stop have been moved to kernel.h. These are not the functions a developer most likely wants to use when they want to insert a place to stop tracing and restart it from user space. tracing_start/tracing_stop was created to work with things like suspend to ram, where even calling smp_processor_id() can crash the system. The tracing_start/tracing_stop was used to stop the tracer from doing anything. These are still light weight functions, but add a bit more overhead to be able to stop the tracers. They also have no interface back to userland. That is, if the kernel calls tracing_stop, userland can not start tracing. What a developer most likely wants to use is tracing_on/tracing_off. These are very light weight functions (simply sets or clears a bit). These functions just stop recording into the ring buffer. The tracers don't even know that this happens except that they would receive NULL from the ring_buffer_lock_reserve function. Also, there's a way for the user land to enable or disable this bit. In debugfs/tracing/tracing_on, a user may echo "0" (same as tracing_off()) or echo "1" (same as tracing_on()) into this file. This becomes handy when a kernel developer is debugging and wants tracing to turn off when it hits an anomaly. Then the developer can examine the trace, and restart tracing if they want to try again (echo 1 > tracing_on). This patch moves the prototypes for tracing_on/tracing_off to kernel.h and comments their use, so that a kernel developer will know how to use them. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kernel.h29
-rw-r--r--include/linux/ring_buffer.h15
2 files changed, 28 insertions, 16 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 08bf5da86676..d4614a8a034b 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -369,8 +369,35 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
369 369
370/* 370/*
371 * General tracing related utility functions - trace_printk(), 371 * General tracing related utility functions - trace_printk(),
372 * tracing_start()/tracing_stop: 372 * tracing_on/tracing_off and tracing_start()/tracing_stop
373 *
374 * Use tracing_on/tracing_off when you want to quickly turn on or off
375 * tracing. It simply enables or disables the recording of the trace events.
376 * This also corresponds to the user space debugfs/tracing/tracing_on
377 * file, which gives a means for the kernel and userspace to interact.
378 * Place a tracing_off() in the kernel where you want tracing to end.
379 * From user space, examine the trace, and then echo 1 > tracing_on
380 * to continue tracing.
381 *
382 * tracing_stop/tracing_start has slightly more overhead. It is used
383 * by things like suspend to ram where disabling the recording of the
384 * trace is not enough, but tracing must actually stop because things
385 * like calling smp_processor_id() may crash the system.
386 *
387 * Most likely, you want to use tracing_on/tracing_off.
373 */ 388 */
389#ifdef CONFIG_RING_BUFFER
390void tracing_on(void);
391void tracing_off(void);
392/* trace_off_permanent stops recording with no way to bring it back */
393void tracing_off_permanent(void);
394int tracing_is_on(void);
395#else
396static inline void tracing_on(void) { }
397static inline void tracing_off(void) { }
398static inline void tracing_off_permanent(void) { }
399static inline int tracing_is_on(void) { return 0; }
400#endif
374#ifdef CONFIG_TRACING 401#ifdef CONFIG_TRACING
375extern void tracing_start(void); 402extern void tracing_start(void);
376extern void tracing_stop(void); 403extern void tracing_stop(void);
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 79fcbc4b09d6..b1a0068a5557 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -124,21 +124,6 @@ void ring_buffer_normalize_time_stamp(int cpu, u64 *ts);
124size_t ring_buffer_page_len(void *page); 124size_t ring_buffer_page_len(void *page);
125 125
126 126
127/*
128 * The below functions are fine to use outside the tracing facility.
129 */
130#ifdef CONFIG_RING_BUFFER
131void tracing_on(void);
132void tracing_off(void);
133void tracing_off_permanent(void);
134int tracing_is_on(void);
135#else
136static inline void tracing_on(void) { }
137static inline void tracing_off(void) { }
138static inline void tracing_off_permanent(void) { }
139static inline int tracing_is_on(void) { return 0; }
140#endif
141
142void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); 127void *ring_buffer_alloc_read_page(struct ring_buffer *buffer);
143void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data); 128void ring_buffer_free_read_page(struct ring_buffer *buffer, void *data);
144int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page, 129int ring_buffer_read_page(struct ring_buffer *buffer, void **data_page,