Skip to content

Commit

Permalink
tracing: move function profiler data out of function struct
Browse files Browse the repository at this point in the history
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: Steven Rostedt <srostedt@redhat.com>
  • Loading branch information
Steven Rostedt committed Mar 25, 2009
1 parent bac429f commit 493762f
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 191 deletions.
4 changes: 0 additions & 4 deletions include/linux/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,6 @@ struct dyn_ftrace {
unsigned long flags;
struct dyn_ftrace *newlist;
};
#ifdef CONFIG_FUNCTION_PROFILER
unsigned long counter;
struct hlist_node node;
#endif
struct dyn_arch_ftrace arch;
};

Expand Down
10 changes: 3 additions & 7 deletions kernel/trace/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -379,20 +379,16 @@ config DYNAMIC_FTRACE

config FUNCTION_PROFILER
bool "Kernel function profiler"
depends on DYNAMIC_FTRACE
depends on FUNCTION_TRACER
default n
help
This option enables the kernel function profiler. When the dynamic
function tracing is enabled, a counter is added into the function
records used by the dynamic function tracer. A file is created in
debugfs called function_profile_enabled which defaults to zero.
This option enables the kernel function profiler. 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
zero is entered, profiling stops. A file in the trace_stats
directory called functions, that show the list of functions that
have been hit and their counters.

This takes up around 320K more memory.

If in doubt, say N

config FTRACE_MCOUNT_RECORD
Expand Down
Loading

0 comments on commit 493762f

Please sign in to comment.