diff options
author | Steven Rostedt <srostedt@redhat.com> | 2009-02-10 00:10:27 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-02-22 18:48:53 -0500 |
commit | 6794c78243bfda020ab184d6d578944f8e90d26c (patch) | |
tree | e697b43e4b757723ed9798c9666b759d9e29ca12 /arch/powerpc/kernel/entry_64.S | |
parent | 17be5b3ddf71d980f67fc826e49b00cd2afd724d (diff) |
powerpc64: port of the function graph tracer
This is a port of the function graph tracer that was written by
Frederic Weisbecker for the x86.
This only works for PPC64 at the moment and only for static tracing.
PPC32 and dynamic function graph tracing support will come later.
The trace produces a visual calling of functions:
# tracer: function_graph
#
# CPU DURATION FUNCTION CALLS
# | | | | | | |
0) 2.224 us | }
0) ! 271.024 us | }
0) ! 320.080 us | }
0) ! 324.656 us | }
0) ! 329.136 us | }
0) | .put_prev_task_fair() {
0) | .update_curr() {
0) 2.240 us | .update_min_vruntime();
0) 6.512 us | }
0) 2.528 us | .__enqueue_entity();
0) + 15.536 us | }
0) | .pick_next_task_fair() {
0) 2.032 us | .__pick_next_entity();
0) 2.064 us | .__clear_buddies();
0) | .set_next_entity() {
0) 2.672 us | .__dequeue_entity();
0) 6.864 us | }
Geoff Lavand tested on PS3.
Tested-by: Geoff Levand <geoffrey.levand@am.sony.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/entry_64.S')
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 383ed6eb0085..a32699e74c3c 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -931,13 +931,65 @@ _GLOBAL(_mcount) | |||
931 | ld r5,0(r5) | 931 | ld r5,0(r5) |
932 | mtctr r5 | 932 | mtctr r5 |
933 | bctrl | 933 | bctrl |
934 | |||
935 | nop | 934 | nop |
935 | |||
936 | |||
937 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
938 | b ftrace_graph_caller | ||
939 | #endif | ||
936 | ld r0, 128(r1) | 940 | ld r0, 128(r1) |
937 | mtlr r0 | 941 | mtlr r0 |
938 | addi r1, r1, 112 | 942 | addi r1, r1, 112 |
939 | _GLOBAL(ftrace_stub) | 943 | _GLOBAL(ftrace_stub) |
940 | blr | 944 | blr |
941 | 945 | ||
942 | #endif | 946 | #endif /* CONFIG_DYNAMIC_FTRACE */ |
943 | #endif | 947 | |
948 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
949 | ftrace_graph_caller: | ||
950 | /* load r4 with local address */ | ||
951 | ld r4, 128(r1) | ||
952 | subi r4, r4, MCOUNT_INSN_SIZE | ||
953 | |||
954 | /* get the parent address */ | ||
955 | ld r11, 112(r1) | ||
956 | addi r3, r11, 16 | ||
957 | |||
958 | bl .prepare_ftrace_return | ||
959 | nop | ||
960 | |||
961 | ld r0, 128(r1) | ||
962 | mtlr r0 | ||
963 | addi r1, r1, 112 | ||
964 | blr | ||
965 | |||
966 | _GLOBAL(return_to_handler) | ||
967 | /* need to save return values */ | ||
968 | std r4, -32(r1) | ||
969 | std r3, -24(r1) | ||
970 | /* save TOC */ | ||
971 | std r2, -16(r1) | ||
972 | std r31, -8(r1) | ||
973 | mr r31, r1 | ||
974 | stdu r1, -112(r1) | ||
975 | |||
976 | /* update the TOC */ | ||
977 | LOAD_REG_IMMEDIATE(r4,ftrace_return_to_handler) | ||
978 | ld r2, 8(r4) | ||
979 | |||
980 | bl .ftrace_return_to_handler | ||
981 | nop | ||
982 | |||
983 | /* return value has real return address */ | ||
984 | mtlr r3 | ||
985 | |||
986 | ld r1, 0(r1) | ||
987 | ld r4, -32(r1) | ||
988 | ld r3, -24(r1) | ||
989 | ld r2, -16(r1) | ||
990 | ld r31, -8(r1) | ||
991 | |||
992 | /* Jump back to real return address */ | ||
993 | blr | ||
994 | #endif /* CONFIG_FUNCTION_GRAPH_TRACER */ | ||
995 | #endif /* CONFIG_FUNCTION_TRACER */ | ||