aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2011-06-03 10:58:48 -0400
committerSteven Rostedt <rostedt@goodmis.org>2011-06-14 22:48:47 -0400
commitffeb80fc30acbf6bd51cb47a1815f621a9d017dc (patch)
tree0291039ad5bc7f652d15157616ea2a77b7294638 /kernel/trace
parent321e68b095addc473ca52ced9acfa59be88f76e6 (diff)
tracing, function_graph: Merge overhead and duration display functions
Functions print_graph_overhead() and print_graph_duration() displays data for one field - DURATION. I merged them into single function print_graph_duration(), and added a way to display the empty parts of the field. This way the print_graph_irq() function can use this column to display the IRQ signs if needed and the DURATION field details stays inside the print_graph_duration() function. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/1307113131-10045-3-git-send-email-jolsa@redhat.com Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_functions_graph.c148
1 files changed, 74 insertions, 74 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 352652eb9aae..44b955fd87bf 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -74,6 +74,20 @@ static struct tracer_flags tracer_flags = {
74 74
75static struct trace_array *graph_array; 75static struct trace_array *graph_array;
76 76
77/*
78 * DURATION column is being also used to display IRQ signs,
79 * following values are used by print_graph_irq and others
80 * to fill in space into DURATION column.
81 */
82enum {
83 DURATION_FILL_FULL = -1,
84 DURATION_FILL_START = -2,
85 DURATION_FILL_END = -3,
86};
87
88static enum print_line_t
89print_graph_duration(unsigned long long duration, struct trace_seq *s,
90 u32 flags);
77 91
78/* Add a function return address to the trace stack on thread info.*/ 92/* Add a function return address to the trace stack on thread info.*/
79int 93int
@@ -577,32 +591,6 @@ get_return_for_leaf(struct trace_iterator *iter,
577 return next; 591 return next;
578} 592}
579 593
580/* Signal a overhead of time execution to the output */
581static int
582print_graph_overhead(unsigned long long duration, struct trace_seq *s,
583 u32 flags)
584{
585 /* If duration disappear, we don't need anything */
586 if (!(flags & TRACE_GRAPH_PRINT_DURATION))
587 return 1;
588
589 /* Non nested entry or return */
590 if (duration == -1)
591 return trace_seq_printf(s, " ");
592
593 if (flags & TRACE_GRAPH_PRINT_OVERHEAD) {
594 /* Duration exceeded 100 msecs */
595 if (duration > 100000ULL)
596 return trace_seq_printf(s, "! ");
597
598 /* Duration exceeded 10 msecs */
599 if (duration > 10000ULL)
600 return trace_seq_printf(s, "+ ");
601 }
602
603 return trace_seq_printf(s, " ");
604}
605
606static int print_graph_abs_time(u64 t, struct trace_seq *s) 594static int print_graph_abs_time(u64 t, struct trace_seq *s)
607{ 595{
608 unsigned long usecs_rem; 596 unsigned long usecs_rem;
@@ -650,9 +638,9 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
650 } 638 }
651 639
652 /* No overhead */ 640 /* No overhead */
653 ret = print_graph_overhead(-1, s, flags); 641 ret = print_graph_duration(DURATION_FILL_START, s, flags);
654 if (!ret) 642 if (ret != TRACE_TYPE_HANDLED)
655 return TRACE_TYPE_PARTIAL_LINE; 643 return ret;
656 644
657 if (type == TRACE_GRAPH_ENT) 645 if (type == TRACE_GRAPH_ENT)
658 ret = trace_seq_printf(s, "==========>"); 646 ret = trace_seq_printf(s, "==========>");
@@ -662,9 +650,10 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
662 if (!ret) 650 if (!ret)
663 return TRACE_TYPE_PARTIAL_LINE; 651 return TRACE_TYPE_PARTIAL_LINE;
664 652
665 /* Don't close the duration column if haven't one */ 653 ret = print_graph_duration(DURATION_FILL_END, s, flags);
666 if (flags & TRACE_GRAPH_PRINT_DURATION) 654 if (ret != TRACE_TYPE_HANDLED)
667 trace_seq_printf(s, " |"); 655 return ret;
656
668 ret = trace_seq_printf(s, "\n"); 657 ret = trace_seq_printf(s, "\n");
669 658
670 if (!ret) 659 if (!ret)
@@ -716,9 +705,48 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
716} 705}
717 706
718static enum print_line_t 707static enum print_line_t
719print_graph_duration(unsigned long long duration, struct trace_seq *s) 708print_graph_duration(unsigned long long duration, struct trace_seq *s,
709 u32 flags)
720{ 710{
721 int ret; 711 int ret = -1;
712
713 if (!(flags & TRACE_GRAPH_PRINT_DURATION))
714 return TRACE_TYPE_HANDLED;
715
716 /* No real adata, just filling the column with spaces */
717 switch (duration) {
718 case DURATION_FILL_FULL:
719 ret = trace_seq_printf(s, " | ");
720 return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
721 case DURATION_FILL_START:
722 ret = trace_seq_printf(s, " ");
723 return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
724 case DURATION_FILL_END:
725 ret = trace_seq_printf(s, " |");
726 return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
727 }
728
729 /* Signal a overhead of time execution to the output */
730 if (flags & TRACE_GRAPH_PRINT_OVERHEAD) {
731 /* Duration exceeded 100 msecs */
732 if (duration > 100000ULL)
733 ret = trace_seq_printf(s, "! ");
734 /* Duration exceeded 10 msecs */
735 else if (duration > 10000ULL)
736 ret = trace_seq_printf(s, "+ ");
737 }
738
739 /*
740 * The -1 means we either did not exceed the duration tresholds
741 * or we dont want to print out the overhead. Either way we need
742 * to fill out the space.
743 */
744 if (ret == -1)
745 ret = trace_seq_printf(s, " ");
746
747 /* Catching here any failure happenned above */
748 if (!ret)
749 return TRACE_TYPE_PARTIAL_LINE;
722 750
723 ret = trace_print_graph_duration(duration, s); 751 ret = trace_print_graph_duration(duration, s);
724 if (ret != TRACE_TYPE_HANDLED) 752 if (ret != TRACE_TYPE_HANDLED)
@@ -767,18 +795,11 @@ print_graph_entry_leaf(struct trace_iterator *iter,
767 cpu_data->enter_funcs[call->depth] = 0; 795 cpu_data->enter_funcs[call->depth] = 0;
768 } 796 }
769 797
770 /* Overhead */ 798 /* Overhead and duration */
771 ret = print_graph_overhead(duration, s, flags); 799 ret = print_graph_duration(duration, s, flags);
772 if (!ret) 800 if (ret == TRACE_TYPE_PARTIAL_LINE)
773 return TRACE_TYPE_PARTIAL_LINE; 801 return TRACE_TYPE_PARTIAL_LINE;
774 802
775 /* Duration */
776 if (flags & TRACE_GRAPH_PRINT_DURATION) {
777 ret = print_graph_duration(duration, s);
778 if (ret == TRACE_TYPE_PARTIAL_LINE)
779 return TRACE_TYPE_PARTIAL_LINE;
780 }
781
782 /* Function */ 803 /* Function */
783 for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) { 804 for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
784 ret = trace_seq_printf(s, " "); 805 ret = trace_seq_printf(s, " ");
@@ -815,17 +836,10 @@ print_graph_entry_nested(struct trace_iterator *iter,
815 cpu_data->enter_funcs[call->depth] = call->func; 836 cpu_data->enter_funcs[call->depth] = call->func;
816 } 837 }
817 838
818 /* No overhead */
819 ret = print_graph_overhead(-1, s, flags);
820 if (!ret)
821 return TRACE_TYPE_PARTIAL_LINE;
822
823 /* No time */ 839 /* No time */
824 if (flags & TRACE_GRAPH_PRINT_DURATION) { 840 ret = print_graph_duration(DURATION_FILL_FULL, s, flags);
825 ret = trace_seq_printf(s, " | "); 841 if (ret != TRACE_TYPE_HANDLED)
826 if (!ret) 842 return ret;
827 return TRACE_TYPE_PARTIAL_LINE;
828 }
829 843
830 /* Function */ 844 /* Function */
831 for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) { 845 for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
@@ -1078,18 +1092,11 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
1078 if (print_graph_prologue(iter, s, 0, 0, flags)) 1092 if (print_graph_prologue(iter, s, 0, 0, flags))
1079 return TRACE_TYPE_PARTIAL_LINE; 1093 return TRACE_TYPE_PARTIAL_LINE;
1080 1094
1081 /* Overhead */ 1095 /* Overhead and duration */
1082 ret = print_graph_overhead(duration, s, flags); 1096 ret = print_graph_duration(duration, s, flags);
1083 if (!ret) 1097 if (ret == TRACE_TYPE_PARTIAL_LINE)
1084 return TRACE_TYPE_PARTIAL_LINE; 1098 return TRACE_TYPE_PARTIAL_LINE;
1085 1099
1086 /* Duration */
1087 if (flags & TRACE_GRAPH_PRINT_DURATION) {
1088 ret = print_graph_duration(duration, s);
1089 if (ret == TRACE_TYPE_PARTIAL_LINE)
1090 return TRACE_TYPE_PARTIAL_LINE;
1091 }
1092
1093 /* Closing brace */ 1100 /* Closing brace */
1094 for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) { 1101 for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) {
1095 ret = trace_seq_printf(s, " "); 1102 ret = trace_seq_printf(s, " ");
@@ -1146,17 +1153,10 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
1146 if (print_graph_prologue(iter, s, 0, 0, flags)) 1153 if (print_graph_prologue(iter, s, 0, 0, flags))
1147 return TRACE_TYPE_PARTIAL_LINE; 1154 return TRACE_TYPE_PARTIAL_LINE;
1148 1155
1149 /* No overhead */
1150 ret = print_graph_overhead(-1, s, flags);
1151 if (!ret)
1152 return TRACE_TYPE_PARTIAL_LINE;
1153
1154 /* No time */ 1156 /* No time */
1155 if (flags & TRACE_GRAPH_PRINT_DURATION) { 1157 ret = print_graph_duration(DURATION_FILL_FULL, s, flags);
1156 ret = trace_seq_printf(s, " | "); 1158 if (ret != TRACE_TYPE_HANDLED)
1157 if (!ret) 1159 return ret;
1158 return TRACE_TYPE_PARTIAL_LINE;
1159 }
1160 1160
1161 /* Indentation */ 1161 /* Indentation */
1162 if (depth > 0) 1162 if (depth > 0)