diff options
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-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 86e45c2658e4..92382af7a213 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c | |||
@@ -112,8 +112,8 @@ enum { | |||
112 | }; | 112 | }; |
113 | 113 | ||
114 | static void | 114 | static void |
115 | print_graph_duration(unsigned long long duration, struct trace_seq *s, | 115 | print_graph_duration(struct trace_array *tr, unsigned long long duration, |
116 | u32 flags); | 116 | struct trace_seq *s, u32 flags); |
117 | 117 | ||
118 | /* Add a function return address to the trace stack on thread info.*/ | 118 | /* Add a function return address to the trace stack on thread info.*/ |
119 | int | 119 | int |
@@ -658,6 +658,7 @@ static void | |||
658 | print_graph_irq(struct trace_iterator *iter, unsigned long addr, | 658 | print_graph_irq(struct trace_iterator *iter, unsigned long addr, |
659 | enum trace_type type, int cpu, pid_t pid, u32 flags) | 659 | enum trace_type type, int cpu, pid_t pid, u32 flags) |
660 | { | 660 | { |
661 | struct trace_array *tr = iter->tr; | ||
661 | struct trace_seq *s = &iter->seq; | 662 | struct trace_seq *s = &iter->seq; |
662 | struct trace_entry *ent = iter->ent; | 663 | struct trace_entry *ent = iter->ent; |
663 | 664 | ||
@@ -665,7 +666,7 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr, | |||
665 | addr >= (unsigned long)__irqentry_text_end) | 666 | addr >= (unsigned long)__irqentry_text_end) |
666 | return; | 667 | return; |
667 | 668 | ||
668 | if (trace_flags & TRACE_ITER_CONTEXT_INFO) { | 669 | if (tr->trace_flags & TRACE_ITER_CONTEXT_INFO) { |
669 | /* Absolute time */ | 670 | /* Absolute time */ |
670 | if (flags & TRACE_GRAPH_PRINT_ABS_TIME) | 671 | if (flags & TRACE_GRAPH_PRINT_ABS_TIME) |
671 | print_graph_abs_time(iter->ts, s); | 672 | print_graph_abs_time(iter->ts, s); |
@@ -681,19 +682,19 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr, | |||
681 | } | 682 | } |
682 | 683 | ||
683 | /* Latency format */ | 684 | /* Latency format */ |
684 | if (trace_flags & TRACE_ITER_LATENCY_FMT) | 685 | if (tr->trace_flags & TRACE_ITER_LATENCY_FMT) |
685 | print_graph_lat_fmt(s, ent); | 686 | print_graph_lat_fmt(s, ent); |
686 | } | 687 | } |
687 | 688 | ||
688 | /* No overhead */ | 689 | /* No overhead */ |
689 | print_graph_duration(0, s, flags | FLAGS_FILL_START); | 690 | print_graph_duration(tr, 0, s, flags | FLAGS_FILL_START); |
690 | 691 | ||
691 | if (type == TRACE_GRAPH_ENT) | 692 | if (type == TRACE_GRAPH_ENT) |
692 | trace_seq_puts(s, "==========>"); | 693 | trace_seq_puts(s, "==========>"); |
693 | else | 694 | else |
694 | trace_seq_puts(s, "<=========="); | 695 | trace_seq_puts(s, "<=========="); |
695 | 696 | ||
696 | print_graph_duration(0, s, flags | FLAGS_FILL_END); | 697 | print_graph_duration(tr, 0, s, flags | FLAGS_FILL_END); |
697 | trace_seq_putc(s, '\n'); | 698 | trace_seq_putc(s, '\n'); |
698 | } | 699 | } |
699 | 700 | ||
@@ -731,11 +732,11 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s) | |||
731 | } | 732 | } |
732 | 733 | ||
733 | static void | 734 | static void |
734 | print_graph_duration(unsigned long long duration, struct trace_seq *s, | 735 | print_graph_duration(struct trace_array *tr, unsigned long long duration, |
735 | u32 flags) | 736 | struct trace_seq *s, u32 flags) |
736 | { | 737 | { |
737 | if (!(flags & TRACE_GRAPH_PRINT_DURATION) || | 738 | if (!(flags & TRACE_GRAPH_PRINT_DURATION) || |
738 | !(trace_flags & TRACE_ITER_CONTEXT_INFO)) | 739 | !(tr->trace_flags & TRACE_ITER_CONTEXT_INFO)) |
739 | return; | 740 | return; |
740 | 741 | ||
741 | /* No real adata, just filling the column with spaces */ | 742 | /* No real adata, just filling the column with spaces */ |
@@ -769,6 +770,7 @@ print_graph_entry_leaf(struct trace_iterator *iter, | |||
769 | struct trace_seq *s, u32 flags) | 770 | struct trace_seq *s, u32 flags) |
770 | { | 771 | { |
771 | struct fgraph_data *data = iter->private; | 772 | struct fgraph_data *data = iter->private; |
773 | struct trace_array *tr = iter->tr; | ||
772 | struct ftrace_graph_ret *graph_ret; | 774 | struct ftrace_graph_ret *graph_ret; |
773 | struct ftrace_graph_ent *call; | 775 | struct ftrace_graph_ent *call; |
774 | unsigned long long duration; | 776 | unsigned long long duration; |
@@ -797,7 +799,7 @@ print_graph_entry_leaf(struct trace_iterator *iter, | |||
797 | } | 799 | } |
798 | 800 | ||
799 | /* Overhead and duration */ | 801 | /* Overhead and duration */ |
800 | print_graph_duration(duration, s, flags); | 802 | print_graph_duration(tr, duration, s, flags); |
801 | 803 | ||
802 | /* Function */ | 804 | /* Function */ |
803 | for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) | 805 | for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) |
@@ -815,6 +817,7 @@ print_graph_entry_nested(struct trace_iterator *iter, | |||
815 | { | 817 | { |
816 | struct ftrace_graph_ent *call = &entry->graph_ent; | 818 | struct ftrace_graph_ent *call = &entry->graph_ent; |
817 | struct fgraph_data *data = iter->private; | 819 | struct fgraph_data *data = iter->private; |
820 | struct trace_array *tr = iter->tr; | ||
818 | int i; | 821 | int i; |
819 | 822 | ||
820 | if (data) { | 823 | if (data) { |
@@ -830,7 +833,7 @@ print_graph_entry_nested(struct trace_iterator *iter, | |||
830 | } | 833 | } |
831 | 834 | ||
832 | /* No time */ | 835 | /* No time */ |
833 | print_graph_duration(0, s, flags | FLAGS_FILL_FULL); | 836 | print_graph_duration(tr, 0, s, flags | FLAGS_FILL_FULL); |
834 | 837 | ||
835 | /* Function */ | 838 | /* Function */ |
836 | for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) | 839 | for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) |
@@ -854,6 +857,7 @@ print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s, | |||
854 | { | 857 | { |
855 | struct fgraph_data *data = iter->private; | 858 | struct fgraph_data *data = iter->private; |
856 | struct trace_entry *ent = iter->ent; | 859 | struct trace_entry *ent = iter->ent; |
860 | struct trace_array *tr = iter->tr; | ||
857 | int cpu = iter->cpu; | 861 | int cpu = iter->cpu; |
858 | 862 | ||
859 | /* Pid */ | 863 | /* Pid */ |
@@ -863,7 +867,7 @@ print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s, | |||
863 | /* Interrupt */ | 867 | /* Interrupt */ |
864 | print_graph_irq(iter, addr, type, cpu, ent->pid, flags); | 868 | print_graph_irq(iter, addr, type, cpu, ent->pid, flags); |
865 | 869 | ||
866 | if (!(trace_flags & TRACE_ITER_CONTEXT_INFO)) | 870 | if (!(tr->trace_flags & TRACE_ITER_CONTEXT_INFO)) |
867 | return; | 871 | return; |
868 | 872 | ||
869 | /* Absolute time */ | 873 | /* Absolute time */ |
@@ -881,7 +885,7 @@ print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s, | |||
881 | } | 885 | } |
882 | 886 | ||
883 | /* Latency format */ | 887 | /* Latency format */ |
884 | if (trace_flags & TRACE_ITER_LATENCY_FMT) | 888 | if (tr->trace_flags & TRACE_ITER_LATENCY_FMT) |
885 | print_graph_lat_fmt(s, ent); | 889 | print_graph_lat_fmt(s, ent); |
886 | 890 | ||
887 | return; | 891 | return; |
@@ -1032,6 +1036,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, | |||
1032 | { | 1036 | { |
1033 | unsigned long long duration = trace->rettime - trace->calltime; | 1037 | unsigned long long duration = trace->rettime - trace->calltime; |
1034 | struct fgraph_data *data = iter->private; | 1038 | struct fgraph_data *data = iter->private; |
1039 | struct trace_array *tr = iter->tr; | ||
1035 | pid_t pid = ent->pid; | 1040 | pid_t pid = ent->pid; |
1036 | int cpu = iter->cpu; | 1041 | int cpu = iter->cpu; |
1037 | int func_match = 1; | 1042 | int func_match = 1; |
@@ -1063,7 +1068,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s, | |||
1063 | print_graph_prologue(iter, s, 0, 0, flags); | 1068 | print_graph_prologue(iter, s, 0, 0, flags); |
1064 | 1069 | ||
1065 | /* Overhead and duration */ | 1070 | /* Overhead and duration */ |
1066 | print_graph_duration(duration, s, flags); | 1071 | print_graph_duration(tr, duration, s, flags); |
1067 | 1072 | ||
1068 | /* Closing brace */ | 1073 | /* Closing brace */ |
1069 | for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) | 1074 | for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) |
@@ -1096,7 +1101,8 @@ static enum print_line_t | |||
1096 | print_graph_comment(struct trace_seq *s, struct trace_entry *ent, | 1101 | print_graph_comment(struct trace_seq *s, struct trace_entry *ent, |
1097 | struct trace_iterator *iter, u32 flags) | 1102 | struct trace_iterator *iter, u32 flags) |
1098 | { | 1103 | { |
1099 | unsigned long sym_flags = (trace_flags & TRACE_ITER_SYM_MASK); | 1104 | struct trace_array *tr = iter->tr; |
1105 | unsigned long sym_flags = (tr->trace_flags & TRACE_ITER_SYM_MASK); | ||
1100 | struct fgraph_data *data = iter->private; | 1106 | struct fgraph_data *data = iter->private; |
1101 | struct trace_event *event; | 1107 | struct trace_event *event; |
1102 | int depth = 0; | 1108 | int depth = 0; |
@@ -1109,7 +1115,7 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent, | |||
1109 | print_graph_prologue(iter, s, 0, 0, flags); | 1115 | print_graph_prologue(iter, s, 0, 0, flags); |
1110 | 1116 | ||
1111 | /* No time */ | 1117 | /* No time */ |
1112 | print_graph_duration(0, s, flags | FLAGS_FILL_FULL); | 1118 | print_graph_duration(tr, 0, s, flags | FLAGS_FILL_FULL); |
1113 | 1119 | ||
1114 | /* Indentation */ | 1120 | /* Indentation */ |
1115 | if (depth > 0) | 1121 | if (depth > 0) |
@@ -1250,9 +1256,10 @@ static void print_lat_header(struct seq_file *s, u32 flags) | |||
1250 | seq_printf(s, "#%.*s||| / \n", size, spaces); | 1256 | seq_printf(s, "#%.*s||| / \n", size, spaces); |
1251 | } | 1257 | } |
1252 | 1258 | ||
1253 | static void __print_graph_headers_flags(struct seq_file *s, u32 flags) | 1259 | static void __print_graph_headers_flags(struct trace_array *tr, |
1260 | struct seq_file *s, u32 flags) | ||
1254 | { | 1261 | { |
1255 | int lat = trace_flags & TRACE_ITER_LATENCY_FMT; | 1262 | int lat = tr->trace_flags & TRACE_ITER_LATENCY_FMT; |
1256 | 1263 | ||
1257 | if (lat) | 1264 | if (lat) |
1258 | print_lat_header(s, flags); | 1265 | print_lat_header(s, flags); |
@@ -1294,11 +1301,12 @@ static void print_graph_headers(struct seq_file *s) | |||
1294 | void print_graph_headers_flags(struct seq_file *s, u32 flags) | 1301 | void print_graph_headers_flags(struct seq_file *s, u32 flags) |
1295 | { | 1302 | { |
1296 | struct trace_iterator *iter = s->private; | 1303 | struct trace_iterator *iter = s->private; |
1304 | struct trace_array *tr = iter->tr; | ||
1297 | 1305 | ||
1298 | if (!(trace_flags & TRACE_ITER_CONTEXT_INFO)) | 1306 | if (!(tr->trace_flags & TRACE_ITER_CONTEXT_INFO)) |
1299 | return; | 1307 | return; |
1300 | 1308 | ||
1301 | if (trace_flags & TRACE_ITER_LATENCY_FMT) { | 1309 | if (tr->trace_flags & TRACE_ITER_LATENCY_FMT) { |
1302 | /* print nothing if the buffers are empty */ | 1310 | /* print nothing if the buffers are empty */ |
1303 | if (trace_empty(iter)) | 1311 | if (trace_empty(iter)) |
1304 | return; | 1312 | return; |
@@ -1306,7 +1314,7 @@ void print_graph_headers_flags(struct seq_file *s, u32 flags) | |||
1306 | print_trace_header(s, iter); | 1314 | print_trace_header(s, iter); |
1307 | } | 1315 | } |
1308 | 1316 | ||
1309 | __print_graph_headers_flags(s, flags); | 1317 | __print_graph_headers_flags(tr, s, flags); |
1310 | } | 1318 | } |
1311 | 1319 | ||
1312 | void graph_trace_open(struct trace_iterator *iter) | 1320 | void graph_trace_open(struct trace_iterator *iter) |