diff options
| author | Frederic Weisbecker <fweisbec@gmail.com> | 2008-11-25 15:07:04 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-11-25 19:59:45 -0500 |
| commit | fb52607afcd0629776f1dc9e657647ceae81dd50 (patch) | |
| tree | 7bf43b41ff8510d3098c089913cce56a9049f0fd /kernel | |
| parent | 509dceef6470442d8c7b8a43ec34125205840b3c (diff) | |
tracing/function-return-tracer: change the name into function-graph-tracer
Impact: cleanup
This patch changes the name of the "return function tracer" into
function-graph-tracer which is a more suitable name for a tracing
which makes one able to retrieve the ordered call stack during
the code flow.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/Makefile | 2 | ||||
| -rw-r--r-- | kernel/fork.c | 4 | ||||
| -rw-r--r-- | kernel/sched.c | 2 | ||||
| -rw-r--r-- | kernel/trace/Kconfig | 19 | ||||
| -rw-r--r-- | kernel/trace/Makefile | 2 | ||||
| -rw-r--r-- | kernel/trace/ftrace.c | 26 | ||||
| -rw-r--r-- | kernel/trace/trace.c | 18 | ||||
| -rw-r--r-- | kernel/trace/trace.h | 12 | ||||
| -rw-r--r-- | kernel/trace/trace_functions_graph.c | 98 |
9 files changed, 142 insertions, 41 deletions
diff --git a/kernel/Makefile b/kernel/Makefile index 03a45e7e87b7..703cf3b7389c 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
| @@ -21,7 +21,7 @@ CFLAGS_REMOVE_cgroup-debug.o = -pg | |||
| 21 | CFLAGS_REMOVE_sched_clock.o = -pg | 21 | CFLAGS_REMOVE_sched_clock.o = -pg |
| 22 | CFLAGS_REMOVE_sched.o = -pg | 22 | CFLAGS_REMOVE_sched.o = -pg |
| 23 | endif | 23 | endif |
| 24 | ifdef CONFIG_FUNCTION_RET_TRACER | 24 | ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 25 | CFLAGS_REMOVE_extable.o = -pg # For __kernel_text_address() | 25 | CFLAGS_REMOVE_extable.o = -pg # For __kernel_text_address() |
| 26 | CFLAGS_REMOVE_module.o = -pg # For __module_text_address() | 26 | CFLAGS_REMOVE_module.o = -pg # For __module_text_address() |
| 27 | endif | 27 | endif |
diff --git a/kernel/fork.c b/kernel/fork.c index d6e1a3205f62..5f82a999c032 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -140,7 +140,7 @@ void free_task(struct task_struct *tsk) | |||
| 140 | prop_local_destroy_single(&tsk->dirties); | 140 | prop_local_destroy_single(&tsk->dirties); |
| 141 | free_thread_info(tsk->stack); | 141 | free_thread_info(tsk->stack); |
| 142 | rt_mutex_debug_task_free(tsk); | 142 | rt_mutex_debug_task_free(tsk); |
| 143 | ftrace_retfunc_exit_task(tsk); | 143 | ftrace_graph_exit_task(tsk); |
| 144 | free_task_struct(tsk); | 144 | free_task_struct(tsk); |
| 145 | } | 145 | } |
| 146 | EXPORT_SYMBOL(free_task); | 146 | EXPORT_SYMBOL(free_task); |
| @@ -1271,7 +1271,7 @@ static struct task_struct *copy_process(unsigned long clone_flags, | |||
| 1271 | total_forks++; | 1271 | total_forks++; |
| 1272 | spin_unlock(¤t->sighand->siglock); | 1272 | spin_unlock(¤t->sighand->siglock); |
| 1273 | write_unlock_irq(&tasklist_lock); | 1273 | write_unlock_irq(&tasklist_lock); |
| 1274 | ftrace_retfunc_init_task(p); | 1274 | ftrace_graph_init_task(p); |
| 1275 | proc_fork_connector(p); | 1275 | proc_fork_connector(p); |
| 1276 | cgroup_post_fork(p); | 1276 | cgroup_post_fork(p); |
| 1277 | return p; | 1277 | return p; |
diff --git a/kernel/sched.c b/kernel/sched.c index 388d9db044ab..52490bf6b884 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -5901,7 +5901,7 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu) | |||
| 5901 | * The idle tasks have their own, simple scheduling class: | 5901 | * The idle tasks have their own, simple scheduling class: |
| 5902 | */ | 5902 | */ |
| 5903 | idle->sched_class = &idle_sched_class; | 5903 | idle->sched_class = &idle_sched_class; |
| 5904 | ftrace_retfunc_init_task(idle); | 5904 | ftrace_graph_init_task(idle); |
| 5905 | } | 5905 | } |
| 5906 | 5906 | ||
| 5907 | /* | 5907 | /* |
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 620feadff67a..eb9b901e0777 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
| @@ -12,7 +12,7 @@ config NOP_TRACER | |||
| 12 | config HAVE_FUNCTION_TRACER | 12 | config HAVE_FUNCTION_TRACER |
| 13 | bool | 13 | bool |
| 14 | 14 | ||
| 15 | config HAVE_FUNCTION_RET_TRACER | 15 | config HAVE_FUNCTION_GRAPH_TRACER |
| 16 | bool | 16 | bool |
| 17 | 17 | ||
| 18 | config HAVE_FUNCTION_TRACE_MCOUNT_TEST | 18 | config HAVE_FUNCTION_TRACE_MCOUNT_TEST |
| @@ -63,15 +63,18 @@ config FUNCTION_TRACER | |||
| 63 | (the bootup default), then the overhead of the instructions is very | 63 | (the bootup default), then the overhead of the instructions is very |
| 64 | small and not measurable even in micro-benchmarks. | 64 | small and not measurable even in micro-benchmarks. |
| 65 | 65 | ||
| 66 | config FUNCTION_RET_TRACER | 66 | config FUNCTION_GRAPH_TRACER |
| 67 | bool "Kernel Function return Tracer" | 67 | bool "Kernel Function Graph Tracer" |
| 68 | depends on HAVE_FUNCTION_RET_TRACER | 68 | depends on HAVE_FUNCTION_GRAPH_TRACER |
| 69 | depends on FUNCTION_TRACER | 69 | depends on FUNCTION_TRACER |
| 70 | help | 70 | help |
| 71 | Enable the kernel to trace a function at its return. | 71 | Enable the kernel to trace a function at both its return |
| 72 | It's first purpose is to trace the duration of functions. | 72 | and its entry. |
| 73 | This is done by setting the current return address on the thread | 73 | It's first purpose is to trace the duration of functions and |
| 74 | info structure of the current task. | 74 | draw a call graph for each thread with some informations like |
| 75 | the return value. | ||
| 76 | This is done by setting the current return address on the current | ||
| 77 | task structure into a stack of calls. | ||
| 75 | 78 | ||
| 76 | config IRQSOFF_TRACER | 79 | config IRQSOFF_TRACER |
| 77 | bool "Interrupts-off Latency Tracer" | 80 | bool "Interrupts-off Latency Tracer" |
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile index cef4bcb4e822..08c5fe6ddc09 100644 --- a/kernel/trace/Makefile +++ b/kernel/trace/Makefile | |||
| @@ -29,7 +29,7 @@ obj-$(CONFIG_NOP_TRACER) += trace_nop.o | |||
| 29 | obj-$(CONFIG_STACK_TRACER) += trace_stack.o | 29 | obj-$(CONFIG_STACK_TRACER) += trace_stack.o |
| 30 | obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o | 30 | obj-$(CONFIG_MMIOTRACE) += trace_mmiotrace.o |
| 31 | obj-$(CONFIG_BOOT_TRACER) += trace_boot.o | 31 | obj-$(CONFIG_BOOT_TRACER) += trace_boot.o |
| 32 | obj-$(CONFIG_FUNCTION_RET_TRACER) += trace_functions_return.o | 32 | obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += trace_functions_graph.o |
| 33 | obj-$(CONFIG_TRACE_BRANCH_PROFILING) += trace_branch.o | 33 | obj-$(CONFIG_TRACE_BRANCH_PROFILING) += trace_branch.o |
| 34 | obj-$(CONFIG_BTS_TRACER) += trace_bts.o | 34 | obj-$(CONFIG_BTS_TRACER) += trace_bts.o |
| 35 | 35 | ||
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 53042f118f23..9e19976af727 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -395,11 +395,11 @@ __ftrace_replace_code(struct dyn_ftrace *rec, int enable) | |||
| 395 | unsigned long ip, fl; | 395 | unsigned long ip, fl; |
| 396 | unsigned long ftrace_addr; | 396 | unsigned long ftrace_addr; |
| 397 | 397 | ||
| 398 | #ifdef CONFIG_FUNCTION_RET_TRACER | 398 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 399 | if (ftrace_tracing_type == FTRACE_TYPE_ENTER) | 399 | if (ftrace_tracing_type == FTRACE_TYPE_ENTER) |
| 400 | ftrace_addr = (unsigned long)ftrace_caller; | 400 | ftrace_addr = (unsigned long)ftrace_caller; |
| 401 | else | 401 | else |
| 402 | ftrace_addr = (unsigned long)ftrace_return_caller; | 402 | ftrace_addr = (unsigned long)ftrace_graph_caller; |
| 403 | #else | 403 | #else |
| 404 | ftrace_addr = (unsigned long)ftrace_caller; | 404 | ftrace_addr = (unsigned long)ftrace_caller; |
| 405 | #endif | 405 | #endif |
| @@ -1496,13 +1496,13 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, | |||
| 1496 | return ret; | 1496 | return ret; |
| 1497 | } | 1497 | } |
| 1498 | 1498 | ||
| 1499 | #ifdef CONFIG_FUNCTION_RET_TRACER | 1499 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 1500 | 1500 | ||
| 1501 | static atomic_t ftrace_retfunc_active; | 1501 | static atomic_t ftrace_retfunc_active; |
| 1502 | 1502 | ||
| 1503 | /* The callback that hooks the return of a function */ | 1503 | /* The callback that hooks the return of a function */ |
| 1504 | trace_function_return_t ftrace_function_return = | 1504 | trace_function_graph_t ftrace_graph_function = |
| 1505 | (trace_function_return_t)ftrace_stub; | 1505 | (trace_function_graph_t)ftrace_stub; |
| 1506 | 1506 | ||
| 1507 | 1507 | ||
| 1508 | /* Try to assign a return stack array on FTRACE_RETSTACK_ALLOC_SIZE tasks. */ | 1508 | /* Try to assign a return stack array on FTRACE_RETSTACK_ALLOC_SIZE tasks. */ |
| @@ -1549,7 +1549,7 @@ free: | |||
| 1549 | } | 1549 | } |
| 1550 | 1550 | ||
| 1551 | /* Allocate a return stack for each task */ | 1551 | /* Allocate a return stack for each task */ |
| 1552 | static int start_return_tracing(void) | 1552 | static int start_graph_tracing(void) |
| 1553 | { | 1553 | { |
| 1554 | struct ftrace_ret_stack **ret_stack_list; | 1554 | struct ftrace_ret_stack **ret_stack_list; |
| 1555 | int ret; | 1555 | int ret; |
| @@ -1569,7 +1569,7 @@ static int start_return_tracing(void) | |||
| 1569 | return ret; | 1569 | return ret; |
| 1570 | } | 1570 | } |
| 1571 | 1571 | ||
| 1572 | int register_ftrace_return(trace_function_return_t func) | 1572 | int register_ftrace_graph(trace_function_graph_t func) |
| 1573 | { | 1573 | { |
| 1574 | int ret = 0; | 1574 | int ret = 0; |
| 1575 | 1575 | ||
| @@ -1584,13 +1584,13 @@ int register_ftrace_return(trace_function_return_t func) | |||
| 1584 | goto out; | 1584 | goto out; |
| 1585 | } | 1585 | } |
| 1586 | atomic_inc(&ftrace_retfunc_active); | 1586 | atomic_inc(&ftrace_retfunc_active); |
| 1587 | ret = start_return_tracing(); | 1587 | ret = start_graph_tracing(); |
| 1588 | if (ret) { | 1588 | if (ret) { |
| 1589 | atomic_dec(&ftrace_retfunc_active); | 1589 | atomic_dec(&ftrace_retfunc_active); |
| 1590 | goto out; | 1590 | goto out; |
| 1591 | } | 1591 | } |
| 1592 | ftrace_tracing_type = FTRACE_TYPE_RETURN; | 1592 | |
