android_kernel_xiaomi_sm8350/kernel/trace
Steven Rostedt 59df055f19 ftrace: trace different functions with a different tracer
Impact: new feature

Currently, the function tracer only gives you an ability to hook
a tracer to all functions being traced. The dynamic function trace
allows you to pick and choose which of those functions will be
traced, but all functions being traced will call all tracers that
registered with the function tracer.

This patch adds a new feature that allows a tracer to hook to specific
functions, even when all functions are being traced. It allows for
different functions to call different tracer hooks.

The way this is accomplished is by a special function that will hook
to the function tracer and will set up a hash table knowing which
tracer hook to call with which function. This is the most general
and easiest method to accomplish this. Later, an arch may choose
to supply their own method in changing the mcount call of a function
to call a different tracer. But that will be an exercise for the
future.

To register a function:

 struct ftrace_hook_ops {
	void			(*func)(unsigned long ip,
					unsigned long parent_ip,
					void **data);
	int			(*callback)(unsigned long ip, void **data);
	void			(*free)(void **data);
 };

 int register_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
				  void *data);

glob is a simple glob to search for the functions to hook.
ops is a pointer to the operations (listed below)
data is the default data to be passed to the hook functions when traced

ops:
 func is the hook function to call when the functions are traced
 callback is a callback function that is called when setting up the hash.
   That is, if the tracer needs to do something special for each
   function, that is being traced, and wants to give each function
   its own data. The address of the entry data is passed to this
   callback, so that the callback may wish to update the entry to
   whatever it would like.
 free is a callback for when the entry is freed. In case the tracer
   allocated any data, it is give the chance to free it.

To unregister we have three functions:

  void
  unregister_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
				void *data)

This will unregister all hooks that match glob, point to ops, and
have its data matching data. (note, if glob is NULL, blank or '*',
all functions will be tested).

  void
  unregister_ftrace_function_hook_func(char *glob,
				 struct ftrace_hook_ops *ops)

This will unregister all functions matching glob that has an entry
pointing to ops.

  void unregister_ftrace_function_hook_all(char *glob)

This simply unregisters all funcs.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
2009-02-16 22:44:09 -05:00
..
blktrace.c tracing/blktrace: move the tracing file to kernel/trace 2009-02-09 10:51:02 +01:00
ftrace.c ftrace: trace different functions with a different tracer 2009-02-16 22:44:09 -05:00
Kconfig tracing/sysprof: add missing tracing_{start,stop}_record_cmdline() 2009-02-11 12:55:19 +01:00
kmemtrace.c tracing: Introduce trace_buffer_{lock_reserve,unlock_commit} 2009-02-06 01:01:41 +01:00
Makefile tracing/blktrace: move the tracing file to kernel/trace 2009-02-09 10:51:02 +01:00
ring_buffer.c Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace 2009-02-13 10:26:45 +01:00
trace_boot.c tracing: Introduce trace_buffer_{lock_reserve,unlock_commit} 2009-02-06 01:01:41 +01:00
trace_branch.c tracing: remove unneeded variable 2009-02-10 12:32:18 -05:00
trace_functions_graph.c tracing: provide correct return value after outputting the event 2009-02-10 12:32:33 -05:00
trace_functions.c trace: Call tracing_reset_online_cpus before tracer->init() 2009-02-06 01:01:41 +01:00
trace_hw_branches.c tracing: fix typos in comments 2009-02-10 12:32:35 -05:00
trace_irqsoff.c trace: Remove unused trace_array_cpu parameter 2009-02-05 14:35:47 +01:00
trace_mmiotrace.c tracing: Introduce trace_buffer_{lock_reserve,unlock_commit} 2009-02-06 01:01:41 +01:00
trace_nop.c trace: Call tracing_reset_online_cpus before tracer->init() 2009-02-06 01:01:41 +01:00
trace_output.c Merge branch 'tip/tracing/core/devel' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace 2009-02-09 10:35:12 +01:00
trace_output.h trace: make the trace_event callbacks return enum print_line_t 2009-02-04 20:48:39 +01:00
trace_power.c tracing/power: move the power trace headers to a dedicated file 2009-02-09 10:51:38 +01:00
trace_sched_switch.c trace: Call tracing_reset_online_cpus before tracer->init() 2009-02-06 01:01:41 +01:00
trace_sched_wakeup.c trace: Remove unused trace_array_cpu parameter 2009-02-05 14:35:47 +01:00
trace_selftest_dynamic.c
trace_selftest.c tracing/function-graph-tracer: provide a selftest for the function graph tracer 2009-02-09 10:51:37 +01:00
trace_stack.c trace: better use of stack_trace_enabled for boot up code 2008-12-18 12:56:56 +01:00
trace_stat.c tracing: trace_stat.c cleanup 2009-01-15 11:31:21 +01:00
trace_stat.h tracing/ftrace: separate events tracing and stats tracing engine 2009-01-14 12:11:37 +01:00
trace_sysprof.c Merge branches 'tracing/ftrace', 'tracing/ring-buffer', 'tracing/sysprof', 'tracing/urgent' and 'linus' into tracing/core 2009-02-13 10:25:18 +01:00
trace_workqueue.c trace_workqueue: use percpu data for workqueue stat 2009-01-20 13:06:59 +01:00
trace.c tracing: fix sparse warning: attribute function with __acquires/__releases 2009-02-11 10:15:42 +01:00
trace.h tracing: splice support for tracing_pipe 2009-02-09 12:24:34 -05:00