From: "Steven Rostedt (Red Hat)" <srost...@redhat.com>

Add the "snapshot" file to the the multi-buffer instances.

  cd /sys/kernel/debug/tracing/instances
  mkdir foo
  ls foo
buffer_size_kb  buffer_total_size_kb  events  free_buffer  set_event
snapshot  trace  trace_clock  trace_marker  trace_options  trace_pipe
tracing_on
  cat foo/snapshot
 # tracer: nop
 #
 #
 # * Snapshot is freed *
 #
 # Snapshot commands:
 # echo 0 > snapshot : Clears and frees snapshot buffer
 # echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.
 #                      Takes a snapshot of the main buffer.
 # echo 2 > snapshot : Clears snapshot buffer (but does not allocate)
 #                      (Doesn't have to be '2' works with any number that
 #                       is not a '0' or '1')

Signed-off-by: Steven Rostedt <rost...@goodmis.org>
---
 kernel/trace/trace.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 1dec636..163743a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4273,9 +4273,9 @@ tracing_snapshot_write(struct file *filp, const char 
__user *ubuf, size_t cnt,
                local_irq_disable();
                /* Now, we're going to swap */
                if (iter->cpu_file == RING_BUFFER_ALL_CPUS)
-                       update_max_tr(&global_trace, current, 
smp_processor_id());
+                       update_max_tr(tr, current, smp_processor_id());
                else
-                       update_max_tr_single(&global_trace, current, 
iter->cpu_file);
+                       update_max_tr_single(tr, current, iter->cpu_file);
                local_irq_enable();
                break;
        default:
@@ -5497,6 +5497,11 @@ init_tracer_debugfs(struct trace_array *tr, struct 
dentry *d_tracer)
 
        trace_create_file("tracing_on", 0644, d_tracer,
                            tr, &rb_simple_fops);
+
+#ifdef CONFIG_TRACER_SNAPSHOT
+       trace_create_file("snapshot", 0644, d_tracer,
+                         (void *)&tr->trace_cpu, &snapshot_fops);
+#endif
 }
 
 static __init int tracer_init_debugfs(void)
@@ -5538,11 +5543,6 @@ static __init int tracer_init_debugfs(void)
                        &ftrace_update_tot_cnt, &tracing_dyn_info_fops);
 #endif
 
-#ifdef CONFIG_TRACER_SNAPSHOT
-       trace_create_file("snapshot", 0644, d_tracer,
-                         (void *)&global_trace.trace_cpu, &snapshot_fops);
-#endif
-
        create_trace_instances(d_tracer);
 
        create_trace_options_dir(&global_trace);
-- 
1.7.10.4


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
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