aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_functions_graph.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace_functions_graph.c')
-rw-r--r--kernel/trace/trace_functions_graph.c63
1 files changed, 60 insertions, 3 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 4c58ccc6427..6f8fe28acba 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -262,6 +262,35 @@ int trace_graph_thresh_entry(struct ftrace_graph_ent *trace)
262 return trace_graph_entry(trace); 262 return trace_graph_entry(trace);
263} 263}
264 264
265static void
266__trace_graph_function(struct trace_array *tr,
267 unsigned long ip, unsigned long flags, int pc)
268{
269 u64 time = trace_clock_local();
270 struct ftrace_graph_ent ent = {
271 .func = ip,
272 .depth = 0,
273 };
274 struct ftrace_graph_ret ret = {
275 .func = ip,
276 .depth = 0,
277 .calltime = time,
278 .rettime = time,
279 };
280
281 __trace_graph_entry(tr, &ent, flags, pc);
282 __trace_graph_return(tr, &ret, flags, pc);
283}
284
285void
286trace_graph_function(struct trace_array *tr,
287 unsigned long ip, unsigned long parent_ip,
288 unsigned long flags, int pc)
289{
290 __trace_graph_function(tr, parent_ip, flags, pc);
291 __trace_graph_function(tr, ip, flags, pc);
292}
293
265void __trace_graph_return(struct trace_array *tr, 294void __trace_graph_return(struct trace_array *tr,
266 struct ftrace_graph_ret *trace, 295 struct ftrace_graph_ret *trace,
267 unsigned long flags, 296 unsigned long flags,
@@ -1179,7 +1208,7 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
1179 1208
1180 1209
1181enum print_line_t 1210enum print_line_t
1182print_graph_function_flags(struct trace_iterator *iter, u32 flags) 1211__print_graph_function_flags(struct trace_iterator *iter, u32 flags)
1183{ 1212{
1184 struct ftrace_graph_ent_entry *field; 1213 struct ftrace_graph_ent_entry *field;
1185 struct fgraph_data *data = iter->private; 1214 struct fgraph_data *data = iter->private;
@@ -1242,7 +1271,18 @@ print_graph_function_flags(struct trace_iterator *iter, u32 flags)
1242static enum print_line_t 1271static enum print_line_t
1243print_graph_function(struct trace_iterator *iter) 1272print_graph_function(struct trace_iterator *iter)
1244{ 1273{
1245 return print_graph_function_flags(iter, tracer_flags.val); 1274 return __print_graph_function_flags(iter, tracer_flags.val);
1275}
1276
1277enum print_line_t print_graph_function_flags(struct trace_iterator *iter,
1278 u32 flags)
1279{
1280 if (trace_flags & TRACE_ITER_LATENCY_FMT)
1281 flags |= TRACE_GRAPH_PRINT_DURATION;
1282 else
1283 flags |= TRACE_GRAPH_PRINT_ABS_TIME;
1284
1285 return __print_graph_function_flags(iter, flags);
1246} 1286}
1247 1287
1248static enum print_line_t 1288static enum print_line_t
@@ -1274,7 +1314,7 @@ static void print_lat_header(struct seq_file *s, u32 flags)
1274 seq_printf(s, "#%.*s|||| / \n", size, spaces); 1314 seq_printf(s, "#%.*s|||| / \n", size, spaces);
1275} 1315}
1276 1316
1277void print_graph_headers_flags(struct seq_file *s, u32 flags) 1317static void __print_graph_headers_flags(struct seq_file *s, u32 flags)
1278{ 1318{
1279 int lat = trace_flags & TRACE_ITER_LATENCY_FMT; 1319 int lat = trace_flags & TRACE_ITER_LATENCY_FMT;
1280 1320
@@ -1315,6 +1355,23 @@ void print_graph_headers(struct seq_file *s)
1315 print_graph_headers_flags(s, tracer_flags.val); 1355 print_graph_headers_flags(s, tracer_flags.val);
1316} 1356}
1317 1357
1358void print_graph_headers_flags(struct seq_file *s, u32 flags)
1359{
1360 struct trace_iterator *iter = s->private;
1361
1362 if (trace_flags & TRACE_ITER_LATENCY_FMT) {
1363 /* print nothing if the buffers are empty */
1364 if (trace_empty(iter))
1365 return;
1366
1367 print_trace_header(s, iter);
1368 flags |= TRACE_GRAPH_PRINT_DURATION;
1369 } else
1370 flags |= TRACE_GRAPH_PRINT_ABS_TIME;
1371
1372 __print_graph_headers_flags(s, flags);
1373}
1374
1318void graph_trace_open(struct trace_iterator *iter) 1375void graph_trace_open(struct trace_iterator *iter)
1319{ 1376{
1320 /* pid and depth on the last trace processed */ 1377 /* pid and depth on the last trace processed */