aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/ring_buffer.c
diff options
context:
space:
mode:
authorDavid Sharp <dhsharp@google.com>2010-12-08 16:46:47 -0500
committerSteven Rostedt <rostedt@goodmis.org>2011-03-09 13:52:27 -0500
commit750912fa366312e9c5bc83eab352898a26750401 (patch)
treebb8e5cd1444a74ea283e3fa55607225e7fda4d70 /kernel/trace/ring_buffer.c
parent2a8247a2600c3e087a568fc68a6ec4eedac27ef1 (diff)
tracing: Add an 'overwrite' trace_option.
Add an "overwrite" trace_option for ftrace to control whether the buffer should be overwritten on overflow or not. The default remains to overwrite old events when the buffer is full. This patch adds the option to instead discard newest events when the buffer is full. This is useful to get a snapshot of traces just after enabling traces. Dropping the current event is also a simpler code path. Signed-off-by: David Sharp <dhsharp@google.com> LKML-Reference: <1291844807-15481-1-git-send-email-dhsharp@google.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/ring_buffer.c')
-rw-r--r--kernel/trace/ring_buffer.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index bd1c35a4fbcc..269db80a961e 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1429,6 +1429,17 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size)
1429} 1429}
1430EXPORT_SYMBOL_GPL(ring_buffer_resize); 1430EXPORT_SYMBOL_GPL(ring_buffer_resize);
1431 1431
1432void ring_buffer_change_overwrite(struct ring_buffer *buffer, int val)
1433{
1434 mutex_lock(&buffer->mutex);
1435 if (val)
1436 buffer->flags |= RB_FL_OVERWRITE;
1437 else
1438 buffer->flags &= ~RB_FL_OVERWRITE;
1439 mutex_unlock(&buffer->mutex);
1440}
1441EXPORT_SYMBOL_GPL(ring_buffer_change_overwrite);
1442
1432static inline void * 1443static inline void *
1433__rb_data_page_index(struct buffer_data_page *bpage, unsigned index) 1444__rb_data_page_index(struct buffer_data_page *bpage, unsigned index)
1434{ 1445{