]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
tracing: show that buffer size is not expanded
authorSteven Rostedt <srostedt@redhat.com>
Thu, 12 Mar 2009 17:53:25 +0000 (13:53 -0400)
committerSteven Rostedt <srostedt@redhat.com>
Fri, 13 Mar 2009 01:14:59 +0000 (21:14 -0400)
Impact: do not confuse user on small trace buffer sizes

When the system boots up, the trace buffer is small to conserve memory.
It is only two pages per online CPU. When the tracer is used, it expands
to the default value.

This can confuse the user if they look at the buffer size and see only
7, but then later they see 1408.

 # cat /debug/tracing/buffer_size_kb
7

 # echo sched_switch > /debug/tracing/current_tracer

 # cat /debug/tracing/buffer_size_kb
1408

This patch tries to help remove this confustion by showing that the
buffer has not been expanded.

 # cat /debug/tracing/buffer_size_kb
7 (expanded: 1408)

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
kernel/trace/trace.c

index 04ab8243a13d1d6ebcb3fb2a6a610b6281e200f9..62a63b2b33dd30dce7be26b850c76efa27ff7c99 100644 (file)
@@ -2948,10 +2948,18 @@ tracing_entries_read(struct file *filp, char __user *ubuf,
                     size_t cnt, loff_t *ppos)
 {
        struct trace_array *tr = filp->private_data;
-       char buf[64];
+       char buf[96];
        int r;
 
-       r = sprintf(buf, "%lu\n", tr->entries >> 10);
+       mutex_lock(&trace_types_lock);
+       if (!ring_buffer_expanded)
+               r = sprintf(buf, "%lu (expanded: %lu)\n",
+                           tr->entries >> 10,
+                           trace_buf_size >> 10);
+       else
+               r = sprintf(buf, "%lu\n", tr->entries >> 10);
+       mutex_unlock(&trace_types_lock);
+
        return simple_read_from_buffer(ubuf, cnt, ppos, buf, r);
 }