diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-21 13:07:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-21 13:07:17 -0400 |
commit | 401c58fcbbf570e7e4a8ee0e21ffd829deb4de0b (patch) | |
tree | 6c61f2d3288f0f299e41e70b79bf91b99ae27764 /tools/lib/traceevent/plugin_function.c | |
parent | 7b08d618a232aa3bfc538cf1eccd9ce0c239bf03 (diff) | |
parent | cf230918cda19532e4a5cc4f0d5c82fa7e5e94f6 (diff) |
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar:
"This is larger than usual: the main reason are the ARM symbol lookup
speedups that came in late and were hard to resist.
There's also a kprobes fix and various tooling fixes, plus the minimal
re-enablement of the mmap2 support interface"
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (36 commits)
x86/kprobes: Fix build errors and blacklist context_track_user
perf tests: Add test for closing dso objects on EMFILE error
perf tests: Add test for caching dso file descriptors
perf tests: Allow reuse of test_file function
perf tests: Spawn child for each test
perf tools: Add dso__data_* interface descriptons
perf tools: Allow to close dso fd in case of open failure
perf tools: Add file size check and factor dso__data_read_offset
perf tools: Cache dso data file descriptor
perf tools: Add global count of opened dso objects
perf tools: Add global list of opened dso objects
perf tools: Add data_fd into dso object
perf tools: Separate dso data related variables
perf tools: Cache register accesses for unwind processing
perf record: Fix to honor user freq/interval properly
perf timechart: Reflow documentation
perf probe: Improve error messages in --line option
perf probe: Improve an error message of perf probe --vars mode
perf probe: Show error code and description in verbose mode
perf probe: Improve error message for unknown member of data structure
...
Diffstat (limited to 'tools/lib/traceevent/plugin_function.c')
-rw-r--r-- | tools/lib/traceevent/plugin_function.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/tools/lib/traceevent/plugin_function.c b/tools/lib/traceevent/plugin_function.c index 80ba4ff1fe84..a00ec190821a 100644 --- a/tools/lib/traceevent/plugin_function.c +++ b/tools/lib/traceevent/plugin_function.c | |||
@@ -33,6 +33,29 @@ static int cpus = -1; | |||
33 | 33 | ||
34 | #define STK_BLK 10 | 34 | #define STK_BLK 10 |
35 | 35 | ||
36 | struct pevent_plugin_option plugin_options[] = | ||
37 | { | ||
38 | { | ||
39 | .name = "parent", | ||
40 | .plugin_alias = "ftrace", | ||
41 | .description = | ||
42 | "Print parent of functions for function events", | ||
43 | }, | ||
44 | { | ||
45 | .name = "indent", | ||
46 | .plugin_alias = "ftrace", | ||
47 | .description = | ||
48 | "Try to show function call indents, based on parents", | ||
49 | .set = 1, | ||
50 | }, | ||
51 | { | ||
52 | .name = NULL, | ||
53 | } | ||
54 | }; | ||
55 | |||
56 | static struct pevent_plugin_option *ftrace_parent = &plugin_options[0]; | ||
57 | static struct pevent_plugin_option *ftrace_indent = &plugin_options[1]; | ||
58 | |||
36 | static void add_child(struct func_stack *stack, const char *child, int pos) | 59 | static void add_child(struct func_stack *stack, const char *child, int pos) |
37 | { | 60 | { |
38 | int i; | 61 | int i; |
@@ -119,7 +142,8 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record, | |||
119 | 142 | ||
120 | parent = pevent_find_function(pevent, pfunction); | 143 | parent = pevent_find_function(pevent, pfunction); |
121 | 144 | ||
122 | index = add_and_get_index(parent, func, record->cpu); | 145 | if (parent && ftrace_indent->set) |
146 | index = add_and_get_index(parent, func, record->cpu); | ||
123 | 147 | ||
124 | trace_seq_printf(s, "%*s", index*3, ""); | 148 | trace_seq_printf(s, "%*s", index*3, ""); |
125 | 149 | ||
@@ -128,11 +152,13 @@ static int function_handler(struct trace_seq *s, struct pevent_record *record, | |||
128 | else | 152 | else |
129 | trace_seq_printf(s, "0x%llx", function); | 153 | trace_seq_printf(s, "0x%llx", function); |
130 | 154 | ||
131 | trace_seq_printf(s, " <-- "); | 155 | if (ftrace_parent->set) { |
132 | if (parent) | 156 | trace_seq_printf(s, " <-- "); |
133 | trace_seq_printf(s, "%s", parent); | 157 | if (parent) |
134 | else | 158 | trace_seq_printf(s, "%s", parent); |
135 | trace_seq_printf(s, "0x%llx", pfunction); | 159 | else |
160 | trace_seq_printf(s, "0x%llx", pfunction); | ||
161 | } | ||
136 | 162 | ||
137 | return 0; | 163 | return 0; |
138 | } | 164 | } |
@@ -141,6 +167,9 @@ int PEVENT_PLUGIN_LOADER(struct pevent *pevent) | |||
141 | { | 167 | { |
142 | pevent_register_event_handler(pevent, -1, "ftrace", "function", | 168 | pevent_register_event_handler(pevent, -1, "ftrace", "function", |
143 | function_handler, NULL); | 169 | function_handler, NULL); |
170 | |||
171 | traceevent_plugin_add_options("ftrace", plugin_options); | ||
172 | |||
144 | return 0; | 173 | return 0; |
145 | } | 174 | } |
146 | 175 | ||
@@ -157,6 +186,8 @@ void PEVENT_PLUGIN_UNLOADER(struct pevent *pevent) | |||
157 | free(fstack[i].stack); | 186 | free(fstack[i].stack); |
158 | } | 187 | } |
159 | 188 | ||
189 | traceevent_plugin_remove_options(plugin_options); | ||
190 | |||
160 | free(fstack); | 191 | free(fstack); |
161 | fstack = NULL; | 192 | fstack = NULL; |
162 | cpus = -1; | 193 | cpus = -1; |