diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-02-17 22:25:25 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-19 06:33:21 -0500 |
commit | d1f9cbd78841f1a797c77e9117e4882f932c2ef6 (patch) | |
tree | 385b85ae60dfca6b4d2c5d8093db07cd6c5fbb20 | |
parent | 4cd0332db7e8f57cc082bab11d82c064a9721737 (diff) |
tracing/function-graph-tracer: fix traces weirdness while absolute time printing
Impact: trace output cleanup/reordering
When an interrupt occurs and and the abstime option is selected:
echo funcgraph-abstime > /debug/tracing/trace_options
then we observe broken traces:
30581.025422 | 0) Xorg-4291 | 0.503 us | idle_cpu();
30581.025424 | 0) Xorg-4291 | 2.576 us | }
30581.025424 | 0) Xorg-4291 | + 75.771 us | }
0) Xorg-4291 | <========== |
30581.025425 | 0) Xorg-4291 | | schedule() {
30581.025426 | 0) Xorg-4291 | | __schedule() {
30581.025426 | 0) Xorg-4291 | 0.705 us | _spin_lock_irq();
With this patch, the interrupts output better adapts
to absolute time printing:
414.856543 | 1) Xorg-4279 | 8.816 us | }
414.856544 | 1) Xorg-4279 | 0.525 us | rcu_irq_exit();
414.856545 | 1) Xorg-4279 | 0.526 us | idle_cpu();
414.856546 | 1) Xorg-4279 | + 12.157 us | }
414.856549 | 1) Xorg-4279 | ! 104.114 us | }
414.856549 | 1) Xorg-4279 | <========== |
414.856549 | 1) Xorg-4279 | ! 107.944 us | }
414.856550 | 1) Xorg-4279 | ! 137.010 us | }
414.856551 | 1) Xorg-4279 | 0.624 us | _read_unlock();
414.856552 | 1) Xorg-4279 | ! 140.930 us | }
414.856552 | 1) Xorg-4279 | ! 166.159 us | }
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/trace/trace_functions_graph.c | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c index 6c7738e4f98b..8f4004a00b4e 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -351,16 +351,35 @@ print_graph_overhead(unsigned long long duration, struct trace_seq *s) | |||
351 | return trace_seq_printf(s, " "); | 351 | return trace_seq_printf(s, " "); |
352 | } | 352 | } |
353 | 353 | ||
354 | static int print_graph_abs_time(u64 t, struct trace_seq *s) | ||
355 | { | ||
356 | unsigned long usecs_rem; | ||
357 | |||
358 | usecs_rem = do_div(t, NSEC_PER_SEC); | ||
359 | usecs_rem /= 1000; | ||
360 | |||
361 | return trace_seq_printf(s, "%5lu.%06lu | ", | ||
362 | (unsigned long)t, usecs_rem); | ||
363 | } | ||
364 | |||
354 | static enum print_line_t | 365 | static enum print_line_t |
355 | print_graph_irq(struct trace_seq *s, unsigned long addr, | 366 | print_graph_irq(struct trace_iterator *iter, unsigned long addr, |
356 | enum trace_type type, int cpu, pid_t pid) | 367 | enum trace_type type, int cpu, pid_t pid) |
357 | { | 368 | { |
358 | int ret; | 369 | int ret; |
370 | struct trace_seq *s = &iter->seq; | ||
359 | 371 | ||
360 | if (addr < (unsigned long)__irqentry_text_start || | 372 | if (addr < (unsigned long)__irqentry_text_start || |
361 | addr >= (unsigned long)__irqentry_text_end) | 373 | addr >= (unsigned long)__irqentry_text_end) |
362 | return TRACE_TYPE_UNHANDLED; | 374 | return TRACE_TYPE_UNHANDLED; |
363 | 375 | ||
376 | /* Absolute time */ | ||
377 | if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME) { | ||
378 | ret = print_graph_abs_time(iter->ts, s); | ||
379 | if (!ret) | ||
380 | return TRACE_TYPE_PARTIAL_LINE; | ||
381 | } | ||
382 | |||
364 | /* Cpu */ | 383 | /* Cpu */ |
365 | if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) { | 384 | if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) { |
366 | ret = print_graph_cpu(s, cpu); | 385 | ret = print_graph_cpu(s, cpu); |
@@ -446,17 +465,6 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s) | |||
446 | 465 | ||
447 | } | 466 | } |
448 | 467 | ||
449 | static int print_graph_abs_time(u64 t, struct trace_seq *s) | ||
450 | { | ||
451 | unsigned long usecs_rem; | ||
452 | |||
453 | usecs_rem = do_div(t, 1000000000); | ||
454 | usecs_rem /= 1000; | ||
455 | |||
456 | return trace_seq_printf(s, "%5lu.%06lu | ", | ||
457 | (unsigned long)t, usecs_rem); | ||
458 | } | ||
459 | |||
460 | /* Case of a leaf function on its call entry */ | 468 | /* Case of a leaf function on its call entry */ |
461 | static enum print_line_t | 469 | static enum print_line_t |
462 | print_graph_entry_leaf(struct trace_iterator *iter, | 470 | print_graph_entry_leaf(struct trace_iterator *iter, |
@@ -561,7 +569,7 @@ print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s, | |||
561 | return TRACE_TYPE_PARTIAL_LINE; | 569 | return TRACE_TYPE_PARTIAL_LINE; |
562 | 570 | ||
563 | /* Interrupt */ | 571 | /* Interrupt */ |
564 | ret = print_graph_irq(s, call->func, TRACE_GRAPH_ENT, cpu, ent->pid); | 572 | ret = print_graph_irq(iter, call->func, TRACE_GRAPH_ENT, cpu, ent->pid); |
565 | if (ret == TRACE_TYPE_PARTIAL_LINE) | 573 | if (ret == TRACE_TYPE_PARTIAL_LINE) |
566 | return TRACE_TYPE_PARTIAL_LINE; | 574 | return TRACE_TYPE_PARTIAL_LINE; |
567 | 575 | ||
@@ -581,7 +589,7 @@ print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s, | |||
581 | 589 | ||
582 | /* Proc */ | 590 | /* Proc */ |
583 | if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC) { | 591 | if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC) { |
584 | ret = print_graph_proc(s, ent->pid); | 592 | ret = print_graph_proc(s, pid); |
585 | if (ret == TRACE_TYPE_PARTIAL_LINE) | 593 | if (ret == TRACE_TYPE_PARTIAL_LINE) |
586 | return TRACE_TYPE_PARTIAL_LINE; | 594 | return TRACE_TYPE_PARTIAL_LINE; |
587 | 595 | ||
@@ -605,11 +613,11 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, | |||
605 | int i; | 613 | int i; |
606 | int ret; | 614 | int ret; |
607 | int cpu = iter->cpu; | 615 | int cpu = iter->cpu; |
608 | pid_t *last_pid = iter->private; | 616 | pid_t *last_pid = iter->private, pid = ent->pid; |
609 | unsigned long long duration = trace->rettime - trace->calltime; | 617 | unsigned long long duration = trace->rettime - trace->calltime; |
610 | 618 | ||
611 | /* Pid */ | 619 | /* Pid */ |
612 | if (verif_pid(s, ent->pid, cpu, last_pid) == TRACE_TYPE_PARTIAL_LINE) | 620 | if (verif_pid(s, pid, cpu, last_pid) == TRACE_TYPE_PARTIAL_LINE) |
613 | return TRACE_TYPE_PARTIAL_LINE; | 621 | return TRACE_TYPE_PARTIAL_LINE; |
614 | 622 | ||
615 | /* Absolute time */ | 623 | /* Absolute time */ |
@@ -668,7 +676,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, | |||
668 | return TRACE_TYPE_PARTIAL_LINE; | 676 | return TRACE_TYPE_PARTIAL_LINE; |
669 | } | 677 | } |
670 | 678 | ||
671 | ret = print_graph_irq(s, trace->func, TRACE_GRAPH_RET, cpu, ent->pid); | 679 | ret = print_graph_irq(iter, trace->func, TRACE_GRAPH_RET, cpu, pid); |
672 | if (ret == TRACE_TYPE_PARTIAL_LINE) | 680 | if (ret == TRACE_TYPE_PARTIAL_LINE) |
673 | return TRACE_TYPE_PARTIAL_LINE; | 681 | return TRACE_TYPE_PARTIAL_LINE; |
674 | 682 | ||
@@ -684,6 +692,10 @@ print_graph_comment(struct print_entry *trace, struct trace_seq *s, | |||
684 | int cpu = iter->cpu; | 692 | int cpu = iter->cpu; |
685 | pid_t *last_pid = iter->private; | 693 | pid_t *last_pid = iter->private; |
686 | 694 | ||
695 | /* Pid */ | ||
696 | if (verif_pid(s, ent->pid, cpu, last_pid) == TRACE_TYPE_PARTIAL_LINE) | ||
697 | return TRACE_TYPE_PARTIAL_LINE; | ||
698 | |||
687 | /* Absolute time */ | 699 | /* Absolute time */ |
688 | if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME) { | 700 | if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME) { |
689 | ret = print_graph_abs_time(iter->ts, s); | 701 | ret = print_graph_abs_time(iter->ts, s); |
@@ -691,10 +703,6 @@ print_graph_comment(struct print_entry *trace, struct trace_seq *s, | |||
691 | return TRACE_TYPE_PARTIAL_LINE; | 703 | return TRACE_TYPE_PARTIAL_LINE; |
692 | } | 704 | } |
693 | 705 | ||
694 | /* Pid */ | ||
695 | if (verif_pid(s, ent->pid, cpu, last_pid) == TRACE_TYPE_PARTIAL_LINE) | ||
696 | return TRACE_TYPE_PARTIAL_LINE; | ||
697 | |||
698 | /* Cpu */ | 706 | /* Cpu */ |
699 | if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) { | 707 | if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) { |
700 | ret = print_graph_cpu(s, cpu); | 708 | ret = print_graph_cpu(s, cpu); |