aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_functions_graph.c
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2015-09-30 09:42:05 -0400
committerSteven Rostedt <rostedt@goodmis.org>2015-09-30 15:22:55 -0400
commit983f938ae69585213bbb779d841b90e75f93f545 (patch)
treeb7d592e16b741e612031e91f032ed97b440fc107 /kernel/trace/trace_functions_graph.c
parent55577204154c7a95c6bce4cb185366d638b238b5 (diff)
tracing: Move trace_flags from global to a trace_array field
In preparation to make trace options per instance, the global trace_flags needs to be moved from being a global variable to a field within the trace instance trace_array structure. There's still more work to do, as there's some functions that use trace_flags without passing in a way to get to the current_trace array. For those, the global_trace is used directly (from trace.c). This includes setting and clearing the trace_flags. This means that when a new instance is created, it just gets the trace_flags of the global_trace and will not be able to modify them. Depending on the functions that have access to the trace_array, the flags of an instance may not affect parts of its trace, where the global_trace is used. These will be fixed in future changes. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r--kernel/trace/trace_functions_graph.c50
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
114static void 114static void
115print_graph_duration(unsigned long long duration, struct trace_seq *s, 115print_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.*/
119int 119int
@@ -658,6 +658,7 @@ static void
658print_graph_irq(struct trace_iterator *iter, unsigned long addr, 658print_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
@@ - #endif /* CONFIG_PPC64 */ #ifdef __KERNEL__ extern struct vdso_data *vdso_data; #endif #endif /* __ASSEMBLY__ */ #endif /* __KERNEL__ */ #endif /* _SYSTEMCFG_H */
d841b90e75f93f545#n667'>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 733static void 734static void 734print_graph_duration(unsigned long long duration, struct trace_seq *s, 735print_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 1096print_graph_comment(struct trace_seq *s, struct trace_entry *ent, 1101print_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 1253static void __print_graph_headers_flags(struct seq_file *s, u32 flags) 1259static 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) 1294void print_graph_headers_flags(struct seq_file *s, u32 flags) 1301void 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 1312void graph_trace_open(struct trace_iterator *iter) 1320void graph_trace_open(struct trace_iterator *iter)