Messages in this thread | | | From | Vaibhav Nagarnaik <> | Date | Fri, 29 Jul 2011 12:09:12 -0700 | Subject | Re: [PATCH 1/5] trace: Add a new readonly entry to report total buffer size |
| |
On Fri, Jul 29, 2011 at 11:01 AM, Steven Rostedt <rostedt@goodmis.org> wrote: > On Tue, 2011-07-26 at 15:59 -0700, Vaibhav Nagarnaik wrote: >> The current file "buffer_size_kb" reports the size of per-cpu buffer and >> not the overall memory allocated which could be misleading. A new file >> "buffer_total_size_kb" adds up all the enabled CPU buffer sizes and >> reports it. This is only a readonly entry. >> >> Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com> >> --- >> kernel/trace/trace.c | 27 +++++++++++++++++++++++++++ >> 1 files changed, 27 insertions(+), 0 deletions(-) >> >> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c >> index e5df02c..ce57c55 100644 >> --- a/kernel/trace/trace.c >> +++ b/kernel/trace/trace.c >> @@ -3569,6 +3569,24 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, >> } >> >> static ssize_t >> +tracing_total_entries_read(struct file *filp, char __user *ubuf, >> + size_t cnt, loff_t *ppos) >> +{ >> + struct trace_array *tr = filp->private_data; >> + char buf[64]; >> + int r, cpu; >> + unsigned long size = 0; >> + >> + mutex_lock(&trace_types_lock); >> + for_each_tracing_cpu(cpu) >> + size += tr->entries >> 10; > > Could you make this consistent with buffer_size_kb as well. That is, if > the buffer is "shrunk", could you have the expanded size printed as > well. > > Thanks, > > -- Steve >
Sure. I forgot about that.
Vaibhav Nagarnaik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |