diff options
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 86 |
1 files changed, 79 insertions, 7 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index ef49e9370b25..76b05980225c 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -262,6 +262,34 @@ int trace_graph_thresh_entry(struct ftrace_graph_ent *trace) | |||
262 | return trace_graph_entry(trace); | 262 | return trace_graph_entry(trace); |
263 | } | 263 | } |
264 | 264 | ||
265 | static void | ||
266 | __trace_graph_function(struct trace_array *tr, | ||
267 | unsigned long ip, unsigned long flags, int pc) | ||
268 | { | ||
269 | u64 time = trace_clock_local(); | ||
270 | struct ftrace_graph_ent ent = { | ||
271 | .func = ip, | ||
272 | .depth = 0, | ||
273 | }; | ||
274 | struct ftrace_graph_ret ret = { | ||
275 | .func = ip, | ||
276 | .depth = 0, | ||
277 | .calltime = time, | ||
278 | .rettime = time, | ||
279 | }; | ||
280 | |||
281 | __trace_graph_entry(tr, &ent, flags, pc); | ||
282 | __trace_graph_return(tr, &ret, flags, pc); | ||
283 | } | ||
284 | |||
285 | void | ||
286 | trace_graph_function(struct trace_array *tr, | ||
287 | unsigned long ip, unsigned long parent_ip, | ||
288 | unsigned long flags, int pc) | ||
289 | { | ||
290 | __trace_graph_function(tr, ip, flags, pc); | ||
291 | } | ||
292 | |||
265 | void __trace_graph_return(struct trace_array *tr, | 293 | void __trace_graph_return(struct trace_array *tr, |
266 | struct ftrace_graph_ret *trace, | 294 | struct ftrace_graph_ret *trace, |
267 | unsigned long flags, | 295 | unsigned long flags, |
@@ -888,12 +916,20 @@ check_irq_entry(struct trace_iterator *iter, u32 flags, | |||
888 | unsigned long addr, int depth) | 916 | unsigned long addr, int depth) |
889 | { | 917 | { |
890 | int cpu = iter->cpu; | 918 | int cpu = iter->cpu; |
919 | int *depth_irq; | ||
891 | struct fgraph_data *data = iter->private; | 920 | struct fgraph_data *data = iter->private; |
892 | int *depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq); | ||
893 | 921 | ||
894 | if (flags & TRACE_GRAPH_PRINT_IRQS) | 922 | /* |
923 | * If we are either displaying irqs, or we got called as | ||
924 | * a graph event and private data does not exist, | ||
925 | * then we bypass the irq check. | ||
926 | */ | ||
927 | if ((flags & TRACE_GRAPH_PRINT_IRQS) || | ||
928 | (!data)) | ||
895 | return 0; | 929 | return 0; |
896 | 930 | ||
931 | depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq); | ||
932 | |||
897 | /* | 933 | /* |
898 | * We are inside the irq code | 934 | * We are inside the irq code |
899 | */ | 935 | */ |
@@ -926,12 +962,20 @@ static int | |||
926 | check_irq_return(struct trace_iterator *iter, u32 flags, int depth) | 962 | check_irq_return(struct trace_iterator *iter, u32 flags, int depth) |
927 | { | 963 | { |
928 | int cpu = iter->cpu; | 964 | int cpu = iter->cpu; |
965 | int *depth_irq; | ||
929 | struct fgraph_data *data = iter->private; | 966 | struct fgraph_data *data = iter->private; |
930 | int *depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq); | ||
931 | 967 | ||
932 | if (flags & TRACE_GRAPH_PRINT_IRQS) | 968 | /* |
969 | * If we are either displaying irqs, or we got called as | ||
970 | * a graph event and private data does not exist, | ||
971 | * then we bypass the irq check. | ||
972 | */ | ||
973 | if ((flags & TRACE_GRAPH_PRINT_IRQS) || | ||
974 | (!data)) | ||
933 | return 0; | 975 | return 0; |
934 | 976 | ||
977 | depth_irq = &(per_cpu_ptr(data->cpu_data, cpu)->depth_irq); | ||
978 | |||
935 | /* | 979 | /* |
936 | * We are not inside the irq code. | 980 | * We are not inside the irq code. |
937 | */ | 981 | */ |
@@ -1163,7 +1207,7 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent, | |||
1163 | 1207 | ||
1164 | 1208 | ||
1165 | enum print_line_t | 1209 | enum print_line_t |
1166 | print_graph_function_flags(struct trace_iterator *iter, u32 flags) | 1210 | __print_graph_function_flags(struct trace_iterator *iter, u32 flags) |
1167 | { | 1211 | { |
1168 | struct ftrace_graph_ent_entry *field; | 1212 | struct ftrace_graph_ent_entry *field; |
1169 | struct fgraph_data *data = iter->private; | 1213 | struct fgraph_data *data = iter->private; |
@@ -1226,7 +1270,18 @@ print_graph_function_flags(struct trace_iterator *iter, u32 flags) | |||
1226 | static enum print_line_t | 1270 | static enum print_line_t |
1227 | print_graph_function(struct trace_iterator *iter) | 1271 | print_graph_function(struct trace_iterator *iter) |
1228 | { | 1272 | { |
1229 | return print_graph_function_flags(iter, tracer_flags.val); | 1273 | return __print_graph_function_flags(iter, tracer_flags.val); |
1274 | } | ||
1275 | |||
1276 | enum print_line_t print_graph_function_flags(struct trace_iterator *iter, | ||
1277 | u32 flags) | ||
1278 | { | ||
1279 | if (trace_flags & TRACE_ITER_LATENCY_FMT) | ||
1280 | flags |= TRACE_GRAPH_PRINT_DURATION; | ||
1281 | else | ||
1282 | flags |= TRACE_GRAPH_PRINT_ABS_TIME; | ||
1283 | |||
1284 | return __print_graph_function_flags(iter, flags); | ||
1230 | } | 1285 | } |
1231 | 1286 | ||
1232 | static enum print_line_t | 1287 | static enum print_line_t |
@@ -1258,7 +1313,7 @@ static void print_lat_header(struct seq_file *s, u32 flags) | |||
1258 | seq_printf(s, "#%.*s|||| / \n", size, spaces); | 1313 | seq_printf(s, "#%.*s|||| / \n", size, spaces); |
1259 | } | 1314 | } |
1260 | 1315 | ||
1261 | void print_graph_headers_flags(struct seq_file *s, u32 flags) | 1316 | static void __print_graph_headers_flags(struct seq_file *s, u32 flags) |
1262 | { | 1317 | { |
1263 | int lat = trace_flags & TRACE_ITER_LATENCY_FMT; | 1318 | int lat = trace_flags & TRACE_ITER_LATENCY_FMT; |
1264 | 1319 | ||
@@ -1299,6 +1354,23 @@ void print_graph_headers(struct seq_file *s) | |||
1299 | print_graph_headers_flags(s, tracer_flags.val); | 1354 | print_graph_headers_flags(s, tracer_flags.val); |
1300 | } | 1355 | } |
1301 | 1356 | ||
1357 | void print_graph_headers_flags(struct seq_file *s, u32 flags) | ||
1358 | { | ||
1359 | struct trace_iterator *iter = s->private; | ||
1360 | |||
1361 | if (trace_flags & TRACE_ITER_LATENCY_FMT) { | ||
1362 | /* print nothing if the buffers are empty */ | ||
1363 | if (trace_empty(iter)) | ||
1364 | return; | ||
1365 | |||
1366 | print_trace_header(s, iter); | ||
1367 | flags |= TRACE_GRAPH_PRINT_DURATION; | ||
1368 | } else | ||
1369 | flags |= TRACE_GRAPH_PRINT_ABS_TIME; | ||
1370 | |||
1371 | __print_graph_headers_flags(s, flags); | ||
1372 | } | ||
1373 | |||
1302 | void graph_trace_open(struct trace_iterator *iter) | 1374 | void graph_trace_open(struct trace_iterator *iter) |
1303 | { | 1375 | { |
1304 | /* pid and depth on the last trace processed */ | 1376 | /* pid and depth on the last trace processed */ |