diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-02-15 09:51:52 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2012-02-21 11:08:27 -0500 |
commit | ced39002f5ea736b716ae233fb68b26d59783912 (patch) | |
tree | 4942ffe3b9e26d5122a5febb885d0b541e3aea33 /kernel/trace/trace_entries.h | |
parent | e59a0bff3ecf389951e3c9378ddfd00f6448bfaa (diff) |
ftrace, perf: Add support to use function tracepoint in perf
Adding perf registration support for the ftrace function event,
so it is now possible to register it via perf interface.
The perf_event struct statically contains ftrace_ops as a handle
for function tracer. The function tracer is registered/unregistered
in open/close actions.
To be efficient, we enable/disable ftrace_ops each time the traced
process is scheduled in/out (via TRACE_REG_PERF_(ADD|DELL) handlers).
This way tracing is enabled only when the process is running.
Intentionally using this way instead of the event's hw state
PERF_HES_STOPPED, which would not disable the ftrace_ops.
It is now possible to use function trace within perf commands
like:
perf record -e ftrace:function ls
perf stat -e ftrace:function ls
Allowed only for root.
Link: http://lkml.kernel.org/r/1329317514-8131-6-git-send-email-jolsa@redhat.com
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_entries.h')
-rw-r--r-- | kernel/trace/trace_entries.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/trace/trace_entries.h b/kernel/trace/trace_entries.h index 93365907f219..47db7eda0531 100644 --- a/kernel/trace/trace_entries.h +++ b/kernel/trace/trace_entries.h | |||
@@ -55,7 +55,7 @@ | |||
55 | /* | 55 | /* |
56 | * Function trace entry - function address and parent function address: | 56 | * Function trace entry - function address and parent function address: |
57 | */ | 57 | */ |
58 | FTRACE_ENTRY(function, ftrace_entry, | 58 | FTRACE_ENTRY_REG(function, ftrace_entry, |
59 | 59 | ||
60 | TRACE_FN, | 60 | TRACE_FN, |
61 | 61 | ||
@@ -64,7 +64,9 @@ FTRACE_ENTRY(function, ftrace_entry, | |||
64 | __field( unsigned long, parent_ip ) | 64 | __field( unsigned long, parent_ip ) |
65 | ), | 65 | ), |
66 | 66 | ||
67 | F_printk(" %lx <-- %lx", __entry->ip, __entry->parent_ip) | 67 | F_printk(" %lx <-- %lx", __entry->ip, __entry->parent_ip), |
68 | |||
69 | perf_ftrace_event_register | ||
68 | ); | 70 | ); |
69 | 71 | ||
70 | /* Function call entry */ | 72 | /* Function call entry */ |