android_kernel_xiaomi_sm8350/kernel/trace
Steven Rostedt 9036990d46 ftrace: restructure tracing start/stop infrastructure
Impact: change where tracing is started up and stopped

Currently, when a new tracer is selected via echo'ing a tracer name into
the current_tracer file, the startup is only done if tracing_enabled is
set to one. If tracing_enabled is changed to zero (by echo'ing 0 into
the tracing_enabled file) a full shutdown is performed.

The full startup and shutdown of a tracer can be expensive and the
user can lose out traces when echo'ing in 0 to the tracing_enabled file,
because the process takes too long. There can also be places that
the user would like to start and stop the tracer several times and
doing the full startup and shutdown of a tracer might be too expensive.

This patch performs the full startup and shutdown when a tracer is
selected. It also adds a way to do a quick start or stop of a tracer.
The quick version is just a flag that prevents the tracing from
taking place, but the overhead of the code is still there.

For example, the startup of a tracer may enable tracepoints, or enable
the function tracer.  The stop and start will just set a flag to
have the tracer ignore the calls when the tracepoint or function trace
is called.  The overhead of the tracer may still be present when
the tracer is stopped, but no tracing will occur. Setting the tracer
to the 'nop' tracer (or any other tracer) will perform the shutdown
of the tracer which will disable the tracepoint or disable the
function tracer.

The tracing_enabled file will simply start or stop tracing.

This change is all internal. The end result for the user should be the same
as before. If tracing_enabled is not set, no trace will happen.
If tracing_enabled is set, then the trace will happen. The tracing_enabled
variable is static between tracers. Enabling  tracing_enabled and
going to another tracer will keep tracing_enabled enabled. Same
is true with disabling tracing_enabled.

This patch will now provide a fast start/stop method to the users
for enabling or disabling tracing.

Note: There were two methods to the struct tracer that were never
 used: The methods start and stop. These were to be used as a hook
 to the reading of the trace output, but ended up not being
 necessary. These two methods are now used to enable the start
 and stop of each tracer, in case the tracer needs to do more than
 just not write into the buffer. For example, the irqsoff tracer
 must stop recording max latencies when tracing is stopped.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2008-11-06 07:51:03 +01:00
..
ftrace.c ftrace: add quick function trace stop 2008-11-06 07:50:51 +01:00
Kconfig ftrace: add quick function trace stop 2008-11-06 07:50:51 +01:00
Makefile ftrace: rename FTRACE to FUNCTION_TRACER 2008-10-20 18:27:03 +02:00
ring_buffer.c ftrace: insert in the ftrace_preempt_disable()/enable() functions 2008-11-04 10:09:49 +01:00
trace_boot.c tracing/ftrace: fix a bug when switch current tracer to sched tracer 2008-11-04 17:14:08 +01:00
trace_functions.c ftrace: restructure tracing start/stop infrastructure 2008-11-06 07:51:03 +01:00
trace_irqsoff.c ftrace: restructure tracing start/stop infrastructure 2008-11-06 07:51:03 +01:00
trace_mmiotrace.c ftrace: preempt disable over interrupt disable 2008-10-14 10:39:09 +02:00
trace_nop.c ftrace: make work with new ring buffer 2008-10-14 10:38:57 +02:00
trace_sched_switch.c ftrace: restructure tracing start/stop infrastructure 2008-11-06 07:51:03 +01:00
trace_sched_wakeup.c ftrace: restructure tracing start/stop infrastructure 2008-11-06 07:51:03 +01:00
trace_selftest_dynamic.c ftrace: fix dynamic ftrace selftest 2008-05-23 21:13:23 +02:00
trace_selftest.c ftrace: remove daemon 2008-10-23 16:00:22 +02:00
trace_stack.c ftrace: insert in the ftrace_preempt_disable()/enable() functions 2008-11-04 10:09:49 +01:00
trace_sysprof.c ftrace: make work with new ring buffer 2008-10-14 10:38:57 +02:00
trace.c ftrace: restructure tracing start/stop infrastructure 2008-11-06 07:51:03 +01:00
trace.h ftrace: restructure tracing start/stop infrastructure 2008-11-06 07:51:03 +01:00