diff options
Diffstat (limited to 'kernel/trace')
| -rw-r--r-- | kernel/trace/trace.h | 4 | ||||
| -rw-r--r-- | kernel/trace/trace_functions_graph.c | 63 | ||||
| -rw-r--r-- | kernel/trace/trace_irqsoff.c | 56 |
3 files changed, 71 insertions, 52 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index d39b3c5454a5..9021f8c0c0c3 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
| @@ -343,6 +343,10 @@ void trace_function(struct trace_array *tr, | |||
| 343 | unsigned long ip, | 343 | unsigned long ip, |
| 344 | unsigned long parent_ip, | 344 | unsigned long parent_ip, |
| 345 | unsigned long flags, int pc); | 345 | unsigned long flags, int pc); |
| 346 | void trace_graph_function(struct trace_array *tr, | ||
| 347 | unsigned long ip, | ||
| 348 | unsigned long parent_ip, | ||
| 349 | unsigned long flags, int pc); | ||
| 346 | void trace_default_header(struct seq_file *m); | 350 | void trace_default_header(struct seq_file *m); |
| 347 | void print_trace_header(struct seq_file *m, struct trace_iterator *iter); | 351 | void print_trace_header(struct seq_file *m, struct trace_iterator *iter); |
| 348 | int trace_empty(struct trace_iterator *iter); | 352 | int trace_empty(struct trace_iterator *iter); |
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 4c58ccc6427c..6f8fe28acba1 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
| @@ -262,6 +262,35 @@ 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, parent_ip, flags, pc); | ||
| 291 | __trace_graph_function(tr, ip, flags, pc); | ||
| 292 | } | ||
| 293 | |||
| 265 | void __trace_graph_return(struct trace_array *tr, | 294 | void __trace_graph_return(struct trace_array *tr, |
| 266 | struct ftrace_graph_ret *trace, | 295 | struct ftrace_graph_ret *trace, |
| 267 | unsigned long flags, | 296 | unsigned long flags, |
| @@ -1179,7 +1208,7 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent, | |||
| 1179 | 1208 | ||
| 1180 | 1209 | ||
| 1181 | enum print_line_t | 1210 | enum print_line_t |
| 1182 | print_graph_function_flags(struct trace_iterator *iter, u32 flags) | 1211 | __print_graph_function_flags(struct trace_iterator *iter, u32 flags) |
| 1183 | { | 1212 | { |
| 1184 | struct ftrace_graph_ent_entry *field; | 1213 | struct ftrace_graph_ent_entry *field; |
| 1185 | struct fgraph_data *data = iter->private; | 1214 | struct fgraph_data *data = iter->private; |
| @@ -1242,7 +1271,18 @@ print_graph_function_flags(struct trace_iterator *iter, u32 flags) | |||
| 1242 | static enum print_line_t | 1271 | static enum print_line_t |
| 1243 | print_graph_function(struct trace_iterator *iter) | 1272 | print_graph_function(struct trace_iterator *iter) |
| 1244 | { | 1273 | { |
| 1245 | return print_graph_function_flags(iter, tracer_flags.val); | 1274 | return __print_graph_function_flags(iter, tracer_flags.val); |
| 1275 | } | ||
| 1276 | |||
| 1277 | enum print_line_t print_graph_function_flags(struct trace_iterator *iter, | ||
| 1278 | u32 flags) | ||
| 1279 | { | ||
| 1280 | if (trace_flags & TRACE_ITER_LATENCY_FMT) | ||
| 1281 | flags |= TRACE_GRAPH_PRINT_DURATION; | ||
| 1282 | else | ||
| 1283 | flags |= TRACE_GRAPH_PRINT_ABS_TIME; | ||
| 1284 | |||
| 1285 | return __print_graph_function_flags(iter, flags); | ||
| 1246 | } | 1286 | } |
| 1247 | 1287 | ||
| 1248 | static enum print_line_t | 1288 | static enum print_line_t |
| @@ -1274,7 +1314,7 @@ static void print_lat_header(struct seq_file *s, u32 flags) | |||
| 1274 | seq_printf(s, "#%.*s|||| / \n", size, spaces); | 1314 | seq_printf(s, "#%.*s|||| / \n", size, spaces); |
| 1275 | } | 1315 | } |
| 1276 | 1316 | ||
| 1277 | void print_graph_headers_flags(struct seq_file *s, u32 flags) | 1317 | static void __print_graph_headers_flags(struct seq_file *s, u32 flags) |
| 1278 | { | 1318 | { |
| 1279 | int lat = trace_flags & TRACE_ITER_LATENCY_FMT; | 1319 | int lat = trace_flags & TRACE_ITER_LATENCY_FMT; |
| 1280 | 1320 | ||
| @@ -1315,6 +1355,23 @@ void print_graph_headers(struct seq_file *s) | |||
| 1315 | print_graph_headers_flags(s, tracer_flags.val); | 1355 | print_graph_headers_flags(s, tracer_flags.val); |
| 1316 | } | 1356 | } |
| 1317 | 1357 | ||
| 1358 | void print_graph_headers_flags(struct seq_file *s, u32 flags) | ||
| 1359 | { | ||
| 1360 | struct trace_iterator *iter = s->private; | ||
| 1361 | |||
| 1362 | if (trace_flags & TRACE_ITER_LATENCY_FMT) { | ||
| 1363 | /* print nothing if the buffers are empty */ | ||
| 1364 | if (trace_empty(iter)) | ||
| 1365 | return; | ||
| 1366 | |||
| 1367 | print_trace_header(s, iter); | ||
| 1368 | flags |= TRACE_GRAPH_PRINT_DURATION; | ||
| 1369 | } else | ||
| 1370 | flags |= TRACE_GRAPH_PRINT_ABS_TIME; | ||
| 1371 | |||
| 1372 | __print_graph_headers_flags(s, flags); | ||
| 1373 | } | ||
| 1374 | |||
| 1318 | void graph_trace_open(struct trace_iterator *iter) | 1375 | void graph_trace_open(struct trace_iterator *iter) |
| 1319 | { | 1376 | { |
| 1320 | /* pid and depth on the last trace processed */ | 1377 | /* pid and depth on the last trace processed */ |
diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c index 73a6b0601f2e..4047e98afcba 100644 --- a/kernel/trace/trace_irqsoff.c +++ b/kernel/trace/trace_irqsoff.c | |||
| @@ -229,75 +229,33 @@ static void irqsoff_trace_close(struct trace_iterator *iter) | |||
| 229 | 229 | ||
| 230 | static enum print_line_t irqsoff_print_line(struct trace_iterator *iter) | 230 | static enum print_line_t irqsoff_print_line(struct trace_iterator *iter) |
| 231 | { | 231 | { |
| 232 | u32 flags = GRAPH_TRACER_FLAGS; | ||
| 233 | |||
| 234 | if (trace_flags & TRACE_ITER_LATENCY_FMT) | ||
| 235 | flags |= TRACE_GRAPH_PRINT_DURATION; | ||
| 236 | else | ||
| 237 | flags |= TRACE_GRAPH_PRINT_ABS_TIME; | ||
| 238 | |||
| 239 | /* | 232 | /* |
| 240 | * In graph mode call the graph tracer output function, | 233 | * In graph mode call the graph tracer output function, |
| 241 | * otherwise go with the TRACE_FN event handler | 234 | * otherwise go with the TRACE_FN event handler |
| 242 | */ | 235 | */ |
| 243 | if (is_graph()) | 236 | if (is_graph()) |
| 244 | return print_graph_function_flags(iter, flags); | 237 | return print_graph_function_flags(iter, GRAPH_TRACER_FLAGS); |
| 245 | 238 | ||
| 246 | return TRACE_TYPE_UNHANDLED; | 239 | return TRACE_TYPE_UNHANDLED; |
| 247 | } | 240 | } |
| 248 | 241 | ||
| 249 | static void irqsoff_print_header(struct seq_file *s) | 242 | static void irqsoff_print_header(struct seq_file *s) |
| 250 | { | 243 | { |
| 251 | if (is_graph()) { | 244 | if (is_graph()) |
| 252 | struct trace_iterator *iter = s->private; | 245 | print_graph_headers_flags(s, GRAPH_TRACER_FLAGS); |
| 253 | u32 flags = GRAPH_TRACER_FLAGS; | 246 | else |
| 254 | |||
| 255 | if (trace_flags & TRACE_ITER_LATENCY_FMT) { | ||
| 256 | /* print nothing if the buffers are empty */ | ||
| 257 | if (trace_empty(iter)) | ||
| 258 | return; | ||
| 259 | |||
| 260 | print_trace_header(s, iter); | ||
| 261 | flags |= TRACE_GRAPH_PRINT_DURATION; | ||
| 262 | } else | ||
| 263 | flags |= TRACE_GRAPH_PRINT_ABS_TIME; | ||
| 264 | |||
| 265 | print_graph_headers_flags(s, flags); | ||
| 266 | } else | ||
| 267 | trace_default_header(s); | 247 | trace_default_header(s); |
| 268 | } | 248 | } |
| 269 | 249 | ||
| 270 | static void | 250 | static void |
| 271 | trace_graph_function(struct trace_array *tr, | ||
| 272 | unsigned long ip, unsigned long flags, int pc) | ||
| 273 | { | ||
| 274 | u64 time = trace_clock_local(); | ||
| 275 | struct ftrace_graph_ent ent = { | ||
| 276 | .func = ip, | ||
| 277 | .depth = 0, | ||
| 278 | }; | ||
| 279 | struct ftrace_graph_ret ret = { | ||
| 280 | .func = ip, | ||
| 281 | .depth = 0, | ||
| 282 | .calltime = time, | ||
| 283 | .rettime = time, | ||
| 284 | }; | ||
| 285 | |||
| 286 | __trace_graph_entry(tr, &ent, flags, pc); | ||
| 287 | __trace_graph_return(tr, &ret, flags, pc); | ||
| 288 | } | ||
| 289 | |||
| 290 | static void | ||
| 291 | __trace_function(struct trace_array *tr, | 251 | __trace_function(struct trace_array *tr, |
| 292 | unsigned long ip, unsigned long parent_ip, | 252 | unsigned long ip, unsigned long parent_ip, |
| 293 | unsigned long flags, int pc) | 253 | unsigned long flags, int pc) |
| 294 | { | 254 | { |
| 295 | if (!is_graph()) | 255 | if (is_graph()) |
| 256 | trace_graph_function(tr, ip, parent_ip, flags, pc); | ||
| 257 | else | ||
| 296 | trace_function(tr, ip, parent_ip, flags, pc); | 258 | trace_function(tr, ip, parent_ip, flags, pc); |
| 297 | else { | ||
| 298 | trace_graph_function(tr, parent_ip, flags, pc); | ||
| 299 | trace_graph_function(tr, ip, flags, pc); | ||
| 300 | } | ||
| 301 | } | 259 | } |
| 302 | 260 | ||
| 303 | #else | 261 | #else |
