Commit 9106b69382912ddc403a307b69bf894a6f3004e4
Committed by
Steven Rostedt
1 parent
77a7f2e94e
Exists in
master
and in
7 other branches
tracing: Add ftrace events for graph tracer
Add ftrace events for graph tracer, so the graph output could be shared with other tracers. Signed-off-by: Jiri Olsa <jolsa@redhat.com> LKML-Reference: <1270227683-14631-2-git-send-email-jolsa@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Showing 1 changed file with 27 additions and 1 deletions Side-by-side Diff
kernel/trace/trace_functions_graph.c
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | #define TRACE_GRAPH_PRINT_OVERHEAD 0x4 |
41 | 41 | #define TRACE_GRAPH_PRINT_PROC 0x8 |
42 | 42 | #define TRACE_GRAPH_PRINT_DURATION 0x10 |
43 | -#define TRACE_GRAPH_PRINT_ABS_TIME 0X20 | |
43 | +#define TRACE_GRAPH_PRINT_ABS_TIME 0x20 | |
44 | 44 | |
45 | 45 | static struct tracer_opt trace_opts[] = { |
46 | 46 | /* Display overruns? (for self-debug purpose) */ |
... | ... | @@ -1096,6 +1096,12 @@ |
1096 | 1096 | return TRACE_TYPE_HANDLED; |
1097 | 1097 | } |
1098 | 1098 | |
1099 | +static enum print_line_t | |
1100 | +print_graph_function_event(struct trace_iterator *iter, int flags) | |
1101 | +{ | |
1102 | + return print_graph_function(iter); | |
1103 | +} | |
1104 | + | |
1099 | 1105 | static void print_lat_header(struct seq_file *s) |
1100 | 1106 | { |
1101 | 1107 | static const char spaces[] = " " /* 16 spaces */ |
... | ... | @@ -1199,6 +1205,16 @@ |
1199 | 1205 | } |
1200 | 1206 | } |
1201 | 1207 | |
1208 | +static struct trace_event graph_trace_entry_event = { | |
1209 | + .type = TRACE_GRAPH_ENT, | |
1210 | + .trace = print_graph_function_event, | |
1211 | +}; | |
1212 | + | |
1213 | +static struct trace_event graph_trace_ret_event = { | |
1214 | + .type = TRACE_GRAPH_RET, | |
1215 | + .trace = print_graph_function_event, | |
1216 | +}; | |
1217 | + | |
1202 | 1218 | static struct tracer graph_trace __read_mostly = { |
1203 | 1219 | .name = "function_graph", |
1204 | 1220 | .open = graph_trace_open, |
... | ... | @@ -1219,6 +1235,16 @@ |
1219 | 1235 | static __init int init_graph_trace(void) |
1220 | 1236 | { |
1221 | 1237 | max_bytes_for_cpu = snprintf(NULL, 0, "%d", nr_cpu_ids - 1); |
1238 | + | |
1239 | + if (!register_ftrace_event(&graph_trace_entry_event)) { | |
1240 | + pr_warning("Warning: could not register graph trace events\n"); | |
1241 | + return 1; | |
1242 | + } | |
1243 | + | |
1244 | + if (!register_ftrace_event(&graph_trace_ret_event)) { | |
1245 | + pr_warning("Warning: could not register graph trace events\n"); | |
1246 | + return 1; | |
1247 | + } | |
1222 | 1248 | |
1223 | 1249 | return register_tracer(&graph_trace); |
1224 | 1250 | } |