Skip to contentSkip to conversation

tracing/function-graph-tracer: implement a print_headers function

PATCH Applied Frederic Weisbecker 2 participants 2 messages Dec 8, 2008 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 tracing/function-graph-tracer: implement a print_headers function

Impact: provide headers to explain a bit the output

This patch implements the print_headers callback for the function graph tracer. These headers are output according to the current trace options.

---

kernel/trace/trace_functions_graph.c +29 -4
index 7ea446d..4434e4e 100644
@@ -606,11 +606,36 @@ print_graph_function(struct trace_iterator *iter)
 	}
 }
 
+static void print_graph_headers(struct seq_file *s)
+{
+	/* 1st line */
+	seq_printf(s, "# ");
+	if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU)
+		seq_printf(s, "CPU ");
+	if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC)
+		seq_printf(s, "TASK/PID     ");
+	if (tracer_flags.val & TRACE_GRAPH_PRINT_OVERHEAD)
+		seq_printf(s, "OVERHEAD/");
+	seq_printf(s, "DURATION            FUNCTION CALLS\n");
+
+	/* 2nd line */
+	seq_printf(s, "# ");
+	if (tracer_flags.val & TRACE_GRAPH_PRINT_CPU)
+		seq_printf(s, "|   ");
+	if (tracer_flags.val & TRACE_GRAPH_PRINT_PROC)
+		seq_printf(s, "|      |     ");
+	if (tracer_flags.val & TRACE_GRAPH_PRINT_OVERHEAD) {
+		seq_printf(s, "|        ");
+		seq_printf(s, "|                   |   |   |   |\n");
+	} else
+		seq_printf(s, "    |               |   |   |   |\n");
+}
 static struct tracer graph_trace __read_mostly = {
-	.name	     = "function_graph",
-	.init	     = graph_trace_init,
-	.reset	     = graph_trace_reset,
-	.print_line = print_graph_function,
+	.name	     	= "function_graph",
+	.init	     	= graph_trace_init,
+	.reset	     	= graph_trace_reset,
+	.print_line	= print_graph_function,
+	.print_header	= print_graph_headers,
 	.flags		= &tracer_flags,
 };
 
Signature · 1 line
1.6.0.4
Applied
#1 lore raw
Quoted 6 lines · Frederic Weisbecker

Impact: provide headers to explain a bit the output

This patch implements the print_headers callback for the function graph tracer. These headers are output according to the current trace options.

applied to tip/tracing/function-graph-tracer, thanks Frederic!

Ingo