diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 23e19d2dbd06..c66578f2fdc2 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -232,11 +232,50 @@ trace_branch_is_leaf(struct trace_iterator *iter, | |||
232 | } | 232 | } |
233 | 233 | ||
234 | 234 | ||
235 | static inline int | 235 | static enum print_line_t |
236 | print_graph_duration(unsigned long long duration, struct trace_seq *s) | 236 | print_graph_duration(unsigned long long duration, struct trace_seq *s) |
237 | { | 237 | { |
238 | unsigned long nsecs_rem = do_div(duration, 1000); | 238 | unsigned long nsecs_rem = do_div(duration, 1000); |
239 | return trace_seq_printf(s, "%4llu.%3lu us | ", duration, nsecs_rem); | 239 | /* log10(ULONG_MAX) + '\0' */ |
240 | char msecs_str[21]; | ||
241 | char nsecs_str[5]; | ||
242 | int ret, len; | ||
243 | int i; | ||
244 | |||
245 | sprintf(msecs_str, "%lu", (unsigned long) duration); | ||
246 | |||
247 | /* Print msecs */ | ||
248 | ret = trace_seq_printf(s, msecs_str); | ||
249 | if (!ret) | ||
250 | return TRACE_TYPE_PARTIAL_LINE; | ||
251 | |||
252 | len = strlen(msecs_str); | ||
253 | |||
254 | /* Print nsecs (we don't want to exceed 7 numbers) */ | ||
255 | if (len < 7) { | ||
256 | snprintf(nsecs_str, 8 - len, "%03lu", nsecs_rem); | ||
257 | ret = trace_seq_printf(s, ".%s", nsecs_str); | ||
258 | if (!ret) | ||
259 | return TRACE_TYPE_PARTIAL_LINE; | ||
260 | len += strlen(nsecs_str); | ||
261 | } | ||
262 | |||
263 | ret = trace_seq_printf(s, " us "); | ||
264 | if (!ret) | ||
265 | return TRACE_TYPE_PARTIAL_LINE; | ||
266 | |||
267 | /* Print remaining spaces to fit the row's width */ | ||
268 | for (i = len; i < 7; i++) { | ||
269 | ret = trace_seq_printf(s, " "); | ||
270 | if (!ret) | ||
271 | return TRACE_TYPE_PARTIAL_LINE; | ||
272 | } | ||
273 | |||
274 | ret = trace_seq_printf(s, "| "); | ||
275 | if (!ret) | ||
276 | return TRACE_TYPE_PARTIAL_LINE; | ||
277 | return TRACE_TYPE_HANDLED; | ||
278 | |||
240 | } | 279 | } |
241 | 280 | ||
242 | /* Signal a overhead of time execution to the output */ | 281 | /* Signal a overhead of time execution to the output */ |
@@ -273,10 +312,6 @@ print_graph_entry_leaf(struct trace_iterator *iter, | |||
273 | call = &entry->graph_ent; | 312 | call = &entry->graph_ent; |
274 | duration = graph_ret->rettime - graph_ret->calltime; | 313 | duration = graph_ret->rettime - graph_ret->calltime; |
275 | 314 | ||
276 | /* Must not exceed 8 characters: 9999.999 us */ | ||
277 | if (duration > 10000000ULL) | ||
278 | duration = 9999999ULL; | ||
279 | |||
280 | /* Overhead */ | 315 | /* Overhead */ |
281 | if (tracer_flags.val & TRACE_GRAPH_PRINT_OVERHEAD) { | 316 | if (tracer_flags.val & TRACE_GRAPH_PRINT_OVERHEAD) { |
282 | ret = print_graph_overhead(duration, s); | 317 | ret = print_graph_overhead(duration, s); |
@@ -286,7 +321,7 @@ print_graph_entry_leaf(struct trace_iterator *iter, | |||
286 | 321 | ||
287 | /* Duration */ | 322 | /* Duration */ |
288 | ret = print_graph_duration(duration, s); | 323 | ret = print_graph_duration(duration, s); |
289 | if (!ret) | 324 | if (ret == TRACE_TYPE_PARTIAL_LINE) |
290 | return TRACE_TYPE_PARTIAL_LINE; | 325 | return TRACE_TYPE_PARTIAL_LINE; |
291 | 326 | ||
292 | /* Function */ | 327 | /* Function */ |
@@ -387,10 +422,6 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, | |||
387 | int ret; | 422 | int ret; |
388 | unsigned long long duration = trace->rettime - trace->calltime; | 423 | unsigned long long duration = trace->rettime - trace->calltime; |
389 | 424 | ||
390 | /* Must not exceed 8 characters: xxxx.yyy us */ | ||
391 | if (duration > 10000000ULL) | ||
392 | duration = 9999999ULL; | ||
393 | |||
394 | /* Pid */ | 425 | /* Pid */ |
395 | if (verif_pid(s, ent->pid, cpu) == TRACE_TYPE_PARTIAL_LINE) | 426 | if (verif_pid(s, ent->pid, cpu) == TRACE_TYPE_PARTIAL_LINE) |
396 | return TRACE_TYPE_PARTIAL_LINE; | 427 | return TRACE_TYPE_PARTIAL_LINE; |
@@ -422,7 +453,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, | |||
422 | 453 | ||
423 | /* Duration */ | 454 | /* Duration */ |
424 | ret = print_graph_duration(duration, s); | 455 | ret = print_graph_duration(duration, s); |
425 | if (!ret) | 456 | if (ret == TRACE_TYPE_PARTIAL_LINE) |
426 | return TRACE_TYPE_PARTIAL_LINE; | 457 | return TRACE_TYPE_PARTIAL_LINE; |
427 | 458 | ||
428 | /* Closing brace */ | 459 | /* Closing brace */ |