diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-03-12 13:53:25 -0400 |
---|---|---|
committer | Steven Rostedt <srostedt@redhat.com> | 2009-03-12 21:14:59 -0400 |
commit | db526ca329f855510e8ce672332eba3304aed590 (patch) | |
tree | d6bdd3384a063d7c58ae807a310ecc80cb91773b /kernel/trace/trace.c | |
parent | 8aabee573dff131a085c63de7667eacd94ba4ccb (diff) |
tracing: show that buffer size is not expanded
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>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r-- | kernel/trace/trace.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 04ab8243a13d..62a63b2b33dd 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -2948,10 +2948,18 @@ tracing_entries_read(struct file *filp, char __user *ubuf, | |||
2948 | size_t cnt, loff_t *ppos) | 2948 | size_t cnt, loff_t *ppos) |
2949 | { | 2949 | { |
2950 | struct trace_array *tr = filp->private_data; | 2950 | struct trace_array *tr = filp->private_data; |
2951 | char buf[64]; | 2951 | char buf[96]; |
2952 | int r; | 2952 | int r; |
2953 | 2953 | ||
2954 | r = sprintf(buf, "%lu\n", tr->entries >> 10); | 2954 | mutex_lock(&trace_types_lock); |
2955 | if (!ring_buffer_expanded) | ||
2956 | r = sprintf(buf, "%lu (expanded: %lu)\n", | ||
2957 | tr->entries >> 10, | ||
2958 | trace_buf_size >> 10); | ||
2959 | else | ||
2960 | r = sprintf(buf, "%lu\n", tr->entries >> 10); | ||
2961 | mutex_unlock(&trace_types_lock); | ||
2962 | |||
2955 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); | 2963 | return simple_read_from_buffer(ubuf, cnt, ppos, buf, r); |
2956 | } | 2964 | } |
2957 | 2965 | ||