Commit 493762fc authored by Steven Rostedt's avatar Steven Rostedt

tracing: move function profiler data out of function struct

Impact: reduce size of memory in function profiler

The function profiler originally introduces its counters into the
function records itself. There is 20 thousand different functions on
a normal system, and that is adding 20 thousand counters for profiling
event when not needed.

A normal run of the profiler yields only a couple of thousand functions
executed, depending on what is being profiled. This means we have around
18 thousand useless counters.

This patch rectifies this by moving the data out of the function
records used by dynamic ftrace. Data is preallocated to hold the functions
when the profiling begins. Checks are made during profiling to see if
more recorcds should be allocated, and they are allocated if it is safe
to do so.

This also removes the dependency from using dynamic ftrace, and also
removes the overhead by having it enabled.
Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
parent bac429f0
...@@ -153,10 +153,6 @@ struct dyn_ftrace { ...@@ -153,10 +153,6 @@ struct dyn_ftrace {
unsigned long flags; unsigned long flags;
struct dyn_ftrace *newlist; struct dyn_ftrace *newlist;
}; };
#ifdef CONFIG_FUNCTION_PROFILER
unsigned long counter;
struct hlist_node node;
#endif
struct dyn_arch_ftrace arch; struct dyn_arch_ftrace arch;
}; };
......
...@@ -379,20 +379,16 @@ config DYNAMIC_FTRACE ...@@ -379,20 +379,16 @@ config DYNAMIC_FTRACE
config FUNCTION_PROFILER config FUNCTION_PROFILER
bool "Kernel function profiler" bool "Kernel function profiler"
depends on DYNAMIC_FTRACE depends on FUNCTION_TRACER
default n default n
help help
This option enables the kernel function profiler. When the dynamic This option enables the kernel function profiler. A file is created
function tracing is enabled, a counter is added into the function in debugfs called function_profile_enabled which defaults to zero.
records used by the dynamic function tracer. A file is created in
debugfs called function_profile_enabled which defaults to zero.
When a 1 is echoed into this file profiling begins, and when a When a 1 is echoed into this file profiling begins, and when a
zero is entered, profiling stops. A file in the trace_stats zero is entered, profiling stops. A file in the trace_stats
directory called functions, that show the list of functions that directory called functions, that show the list of functions that
have been hit and their counters. have been hit and their counters.
This takes up around 320K more memory.
If in doubt, say N If in doubt, say N
config FTRACE_MCOUNT_RECORD config FTRACE_MCOUNT_RECORD
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment