aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-02-14 19:17:02 -0500
committerSteven Rostedt <srostedt@redhat.com>2009-02-16 22:50:01 -0500
commit988ae9d6b2bc3ebdc1a488490250a6812f85e9d4 (patch)
tree2674e810891133bc7ddb935baa6c15a0412e2a8f
parent59df055f1991c9fc0c71a9230663c39188f6972f (diff)
ring-buffer: add tracing_is_on to test if ring buffer is enabled
This patch adds the tracing_is_on() interface to tell if the ring buffer is turned on or not. Signed-off-by: Steven Rostedt <srostedt@redhat.com>
-rw-r--r--include/linux/ring_buffer.h2
-rw-r--r--kernel/trace/ring_buffer.c9
2 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 8e6646a54acf..f5e793d69bd3 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -128,10 +128,12 @@ void ring_buffer_normalize_time_stamp(int cpu, u64 *ts);
128void tracing_on(void); 128void tracing_on(void);
129void tracing_off(void); 129void tracing_off(void);
130void tracing_off_permanent(void); 130void tracing_off_permanent(void);
131int tracing_is_on(void);
131#else 132#else
132static inline void tracing_on(void) { } 133static inline void tracing_on(void) { }
133static inline void tracing_off(void) { } 134static inline void tracing_off(void) { }
134static inline void tracing_off_permanent(void) { } 135static inline void tracing_off_permanent(void) { }
136static inline int tracing_is_on(void) { return 0; }
135#endif 137#endif
136 138
137void *ring_buffer_alloc_read_page(struct ring_buffer *buffer); 139void *ring_buffer_alloc_read_page(struct ring_buffer *buffer);
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 2b4626ce95d6..8f19f1aa42b0 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -98,6 +98,15 @@ void tracing_off_permanent(void)
98 set_bit(RB_BUFFERS_DISABLED_BIT, &ring_buffer_flags); 98 set_bit(RB_BUFFERS_DISABLED_BIT, &ring_buffer_flags);
99} 99}
100 100
101/**
102 * tracing_is_on - show state of ring buffers enabled
103 */
104int tracing_is_on(void)
105{
106 return ring_buffer_flags == RB_BUFFERS_ON;
107}
108EXPORT_SYMBOL_GPL(tracing_is_on);
109
101#include "trace.h" 110#include "trace.h"
102 111
103/* Up this if you want to test the TIME_EXTENTS and normalization */ 112/* Up this if you want to test the TIME_EXTENTS and normalization */