This patch resets the trace when it is started by the user.

Signed-off-by: Steven Rostedt <[EMAIL PROTECTED]>
---
 lib/tracing/tracer.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

Index: linux-compile.git/lib/tracing/tracer.c
===================================================================
--- linux-compile.git.orig/lib/tracing/tracer.c 2008-01-14 13:14:13.000000000 
-0500
+++ linux-compile.git/lib/tracing/tracer.c      2008-01-14 14:57:54.000000000 
-0500
@@ -88,6 +88,16 @@ static struct mcount_ops trace_ops __rea
        .func = trace_function,
 };
 
+static notrace void mctracer_reset(struct mctracer_trace *tr)
+{
+       int cpu;
+
+       for_each_online_cpu(cpu) {
+               tr->trace_idx[cpu] = 0;
+               atomic_set(&tr->underrun[cpu], 0);
+       }
+}
+
 #ifdef CONFIG_DEBUG_FS
 enum trace_iterator {
        TRACE_ITER_SYM_ONLY     = 1,
@@ -334,6 +344,10 @@ static ssize_t mctracer_ctrl_write(struc
 
        val = !!simple_strtoul(buf, NULL, 10);
 
+       /* When starting a new trace, reset the buffers */
+       if (val)
+               mctracer_reset(tr);
+
        if (tr->ctrl ^ val) {
                if (val)
                        trace_enabled = 1;

-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to