aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_functions_graph.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2009-03-19 11:29:23 -0400
committerSteven Rostedt <srostedt@redhat.com>2009-03-19 11:29:23 -0400
commitac5f6c96859e9a664ac05b04bc96ed1caad5fe29 (patch)
tree0795e1695c645e3e8b5a4d6631f086373b241e1d /kernel/trace/trace_functions_graph.c
parente9d9df44736d116726f4596f7e2f9ce2764ffc0a (diff)
function-graph: consolidate prologues for output
Impact: clean up The prologue of the function graph entry, return and comments all start out pretty much the same. Each of these duplicate code and do so slightly differently. This patch consolidates the printing of the pid, absolute time, cpu and proc (and for entry, the interrupt). Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r--kernel/trace/trace_functions_graph.c98
1 files changed, 29 insertions, 69 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 6004ccac2dd7..2d4d185cd0d8 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -554,24 +554,24 @@ print_graph_entry_nested(struct ftrace_graph_ent_entry *entry,
554} 554}
555 555
556static enum print_line_t 556static enum print_line_t
557print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s, 557print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s,
558 struct trace_iterator *iter) 558 int type, unsigned long addr)
559{ 559{
560 int ret;
561 int cpu = iter->cpu;
562 pid_t *last_entry = iter->private;
563 struct trace_entry *ent = iter->ent; 560 struct trace_entry *ent = iter->ent;
564 struct ftrace_graph_ent *call = &field->graph_ent; 561 pid_t *last_pid = iter->private;
565 struct ftrace_graph_ret_entry *leaf_ret; 562 int cpu = iter->cpu;
563 int ret;
566 564
567 /* Pid */ 565 /* Pid */
568 if (verif_pid(s, ent->pid, cpu, last_entry) == TRACE_TYPE_PARTIAL_LINE) 566 if (verif_pid(s, ent->pid, cpu, last_pid) == TRACE_TYPE_PARTIAL_LINE)
569 return TRACE_TYPE_PARTIAL_LINE; 567 return TRACE_TYPE_PARTIAL_LINE;
570 568
571 /* Interrupt */ 569 if (type) {
572 ret = print_graph_irq(iter, call->func, TRACE_GRAPH_ENT, cpu, ent->pid); 570 /* Interrupt */
573 if (ret == TRACE_TYPE_PARTIAL_LINE) 571 ret = print_graph_irq(iter, addr, type, cpu, ent->pid);
574 return TRACE_TYPE_PARTIAL_LINE; 572 if (ret == TRACE_TYPE_PARTIAL_LINE)
573 return TRACE_TYPE_PARTIAL_LINE;
574 }
575 575
576 /* Absolute time */ 576 /* Absolute time */
577 if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME) { 577 if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME) {
@@ -598,6 +598,20 @@ print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s,
598 return TRACE_TYPE_PARTIAL_LINE; 598 return TRACE_TYPE_PARTIAL_LINE;
599 } 599 }
600 600
601 return 0;
602}
603
604static enum print_line_t
605print_graph_entry(struct ftrace_graph_ent_entry *field, struct trace_seq *s,
606 struct trace_iterator *iter)
607{
608 int cpu = iter->cpu;
609 struct ftrace_graph_ent *call = &field->graph_ent;
610 struct ftrace_graph_ret_entry *leaf_ret;
611
612 if (print_graph_prologue(iter, s, TRACE_GRAPH_ENT, call->func))
613 return TRACE_TYPE_PARTIAL_LINE;
614
601 leaf_ret = get_return_for_leaf(iter, field); 615 leaf_ret = get_return_for_leaf(iter, field);
602 if (leaf_ret) 616 if (leaf_ret)
603 return print_graph_entry_leaf(iter, field, leaf_ret, s); 617 return print_graph_entry_leaf(iter, field, leaf_ret, s);
@@ -613,38 +627,12 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
613 int i; 627 int i;
614 int ret; 628 int ret;
615 int cpu = iter->cpu; 629 int cpu = iter->cpu;
616 pid_t *last_pid = iter->private, pid = ent->pid; 630 pid_t pid = ent->pid;
617 unsigned long long duration = trace->rettime - trace->calltime; 631 unsigned long long duration = trace->rettime - trace->calltime;
618 632
619 /* Pid */ 633 if (print_graph_prologue(iter, s, 0, 0))
620 if (verif_pid(s, pid, cpu, last_pid) == TRACE_TYPE_PARTIAL_LINE)
621 return TRACE_TYPE_PARTIAL_LINE; 634 return TRACE_TYPE_PARTIAL_LINE;
622 635
623 /* Absolute time */
624 if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME) {
625 ret = print_graph_abs_time(iter->ts, s);
626 if (!ret)
627 return TRACE_TYPE_PARTIAL_LINE;
628 }
629
630 /* Cpu */
631 if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) {
632 ret = print_graph_cpu(s, cpu);
633 if (ret == TRACE_TYPE_PARTIAL_LINE)
634 return TRACE_TYPE_PARTIAL_LINE;
635 }
636
637 /* Proc */
638 if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC) {
639 ret = print_graph_proc(s, ent->pid);
640 if (ret == TRACE_TYPE_PARTIAL_LINE)
641 return TRACE_TYPE_PARTIAL_LINE;
642
643 ret = trace_seq_printf(s, " | ");
644 if (!ret)
645 return TRACE_TYPE_PARTIAL_LINE;
646 }
647
648 /* Overhead */ 636 /* Overhead */
649 ret = print_graph_overhead(duration, s); 637 ret = print_graph_overhead(duration, s);
650 if (!ret) 638 if (!ret)
@@ -689,38 +677,10 @@ print_graph_comment(struct bprint_entry *trace, struct trace_seq *s,
689{ 677{
690 int i; 678 int i;
691 int ret; 679 int ret;
692 int cpu = iter->cpu;
693 pid_t *last_pid = iter->private;
694 680
695 /* Pid */ 681 if (print_graph_prologue(iter, s, 0, 0))
696 if (verif_pid(s, ent->pid, cpu, last_pid) == TRACE_TYPE_PARTIAL_LINE)
697 return TRACE_TYPE_PARTIAL_LINE; 682 return TRACE_TYPE_PARTIAL_LINE;
698 683
699 /* Absolute time */
700 if (tracer_flags.val & TRACE_GRAPH_PRINT_ABS_TIME) {
701 ret = print_graph_abs_time(iter->ts, s);
702 if (!ret)
703 return TRACE_TYPE_PARTIAL_LINE;
704 }
705
706 /* Cpu */
707 if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU) {
708 ret = print_graph_cpu(s, cpu);
709 if (ret == TRACE_TYPE_PARTIAL_LINE)
710 return TRACE_TYPE_PARTIAL_LINE;
711 }
712
713 /* Proc */
714 if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC) {
715 ret = print_graph_proc(s, ent->pid);
716 if (ret == TRACE_TYPE_PARTIAL_LINE)
717 return TRACE_TYPE_PARTIAL_LINE;
718
719 ret = trace_seq_printf(s, " | ");
720 if (!ret)
721 return TRACE_TYPE_PARTIAL_LINE;
722 }
723
724 /* No overhead */ 684 /* No overhead */
725 ret = print_graph_overhead(-1, s); 685 ret = print_graph_overhead(-1, s);
726 if (!ret) 686 if (!ret)