ring-buffer: add tracing_is_on to test if ring buffer is enabled
authorSteven Rostedt <srostedt@redhat.com>
Sun, 15 Feb 2009 00:17:02 +0000 (19:17 -0500)
committerSteven Rostedt <srostedt@redhat.com>
Tue, 17 Feb 2009 03:50:01 +0000 (22:50 -0500)
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>
include/linux/ring_buffer.h
kernel/trace/ring_buffer.c

index 8e6646a54acf84ba8c129945d4e189fbc4e88993..f5e793d69bd30a62e06be6ce904de39f71c1d60c 100644 (file)
@@ -128,10 +128,12 @@ void ring_buffer_normalize_time_stamp(int cpu, u64 *ts);
 void tracing_on(void);
 void tracing_off(void);
 void tracing_off_permanent(void);
+int tracing_is_on(void);
 #else
 static inline void tracing_on(void) { }
 static inline void tracing_off(void) { }
 static inline void tracing_off_permanent(void) { }
+static inline int tracing_is_on(void) { return 0; }
 #endif
 
 void *ring_buffer_alloc_read_page(struct ring_buffer *buffer);
index 2b4626ce95d62e08d6c8be5360ead9621ae6527d..8f19f1aa42b02dc0953e435b41319d0bb23924e5 100644 (file)
@@ -98,6 +98,15 @@ void tracing_off_permanent(void)
        set_bit(RB_BUFFERS_DISABLED_BIT, &ring_buffer_flags);
 }
 
+/**
+ * tracing_is_on - show state of ring buffers enabled
+ */
+int tracing_is_on(void)
+{
+       return ring_buffer_flags == RB_BUFFERS_ON;
+}
+EXPORT_SYMBOL_GPL(tracing_is_on);
+
 #include "trace.h"
 
 /* Up this if you want to test the TIME_EXTENTS and normalization */