aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.c
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <srostedt@redhat.com>2013-03-05 21:23:55 -0500
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 00:35:49 -0400
commitce9bae55972b228cf7bac34350c4d2caf8ea0d0b (patch)
tree637ef0eb957989c40ae4749c090764cff640014d /kernel/trace/trace.c
parent737223fbca3b1c91feb947c7f571b35749b743b6 (diff)
tracing: Add snapshot feature to instances
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 <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace.c')
-rw-r--r--kernel/trace/trace.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 57895d476509..17671bc9a4b1 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4302,9 +4302,9 @@ tracing_snapshot_write(struct file *filp, const char __user *ubuf, size_t cnt,
4302 local_irq_disable(); 4302 local_irq_disable();
4303 /* Now, we're going to swap */ 4303 /* Now, we're going to swap */
4304 if (iter->cpu_file == RING_BUFFER_ALL_CPUS) 4304 if (iter->cpu_file == RING_BUFFER_ALL_CPUS)
4305 update_max_tr(&global_trace, current, smp_processor_id()); 4305 update_max_tr(tr, current, smp_processor_id());
4306 else 4306 else
4307 update_max_tr_single(&global_trace, current, iter->cpu_file); 4307 update_max_tr_single(tr, current, iter->cpu_file);
4308 local_irq_enable(); 4308 local_irq_enable();
4309 break; 4309 break;
4310 default: 4310 default:
@@ -5533,6 +5533,11 @@ init_tracer_debugfs(struct trace_array *tr, struct dentry *d_tracer)
5533 5533
5534 trace_create_file("tracing_on", 0644, d_tracer, 5534 trace_create_file("tracing_on", 0644, d_tracer,
5535 tr, &rb_simple_fops); 5535 tr, &rb_simple_fops);
5536
5537#ifdef CONFIG_TRACER_SNAPSHOT
5538 trace_create_file("snapshot", 0644, d_tracer,
5539 (void *)&tr->trace_cpu, &snapshot_fops);
5540#endif
5536} 5541}
5537 5542
5538static __init int tracer_init_debugfs(void) 5543static __init int tracer_init_debugfs(void)
@@ -5574,11 +5579,6 @@ static __init int tracer_init_debugfs(void)
5574 &ftrace_update_tot_cnt, &tracing_dyn_info_fops); 5579 &ftrace_update_tot_cnt, &tracing_dyn_info_fops);
5575#endif 5580#endif
5576 5581
5577#ifdef CONFIG_TRACER_SNAPSHOT
5578 trace_create_file("snapshot", 0644, d_tracer,
5579 (void *)&global_trace.trace_cpu, &snapshot_fops);
5580#endif
5581
5582 create_trace_instances(d_tracer); 5582 create_trace_instances(d_tracer);
5583 5583
5584 create_trace_options_dir(&global_trace); 5584 create_trace_options_dir(&global_trace);