]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ftrace: add thread comm to function graph tracer
authorSteven Rostedt <rostedt@goodmis.org>
Wed, 26 Nov 2008 05:16:26 +0000 (00:16 -0500)
committerIngo Molnar <mingo@elte.hu>
Wed, 26 Nov 2008 05:52:56 +0000 (06:52 +0100)
Impact: enhancement to function graph tracer

Export the trace_find_cmdline so the function graph tracer can
use it to print the comms of the threads.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_functions_graph.c

index 9d5f7c94f251aa33e2f07ca8197a24d7af09c44f..5811e0a5f732f3188a16f40d7191197566586340 100644 (file)
@@ -804,7 +804,7 @@ static void trace_save_cmdline(struct task_struct *tsk)
        spin_unlock(&trace_cmdline_lock);
 }
 
-static char *trace_find_cmdline(int pid)
+char *trace_find_cmdline(int pid)
 {
        char *cmdline = "<...>";
        unsigned map;
index ffe1bb1eb62039eed9c74b39c2320c557c9c986b..7adacf349ef7eea82a62a1409bff50ff62c12ba0 100644 (file)
@@ -450,6 +450,7 @@ struct tracer_switch_ops {
        struct tracer_switch_ops        *next;
 };
 
+char *trace_find_cmdline(int pid);
 #endif /* CONFIG_CONTEXT_SWITCH_TRACER */
 
 #ifdef CONFIG_DYNAMIC_FTRACE
index b6f0cc2a00cbe8af8d7dcf1a77781b49dcb3d0b7..bbb81e7b6c40022a5dfdbca88adb2568f1a9b348 100644 (file)
@@ -32,29 +32,40 @@ static pid_t last_pid = -1;
 
 static int graph_trace_init(struct trace_array *tr)
 {
-       int cpu;
+       int cpu, ret;
+
        for_each_online_cpu(cpu)
                tracing_reset(tr, cpu);
 
-       return register_ftrace_graph(&trace_graph_return,
+       ret = register_ftrace_graph(&trace_graph_return,
                                        &trace_graph_entry);
+       if (ret)
+               return ret;
+       tracing_start_cmdline_record();
+
+       return 0;
 }
 
 static void graph_trace_reset(struct trace_array *tr)
 {
-               unregister_ftrace_graph();
+       tracing_stop_cmdline_record();
+       unregister_ftrace_graph();
 }
 
 /* If the pid changed since the last trace, output this event */
 static int verif_pid(struct trace_seq *s, pid_t pid)
 {
+       char *comm;
+
        if (last_pid != -1 && last_pid == pid)
                return 1;
 
        last_pid = pid;
-       return trace_seq_printf(s, "\n------------8<---------- thread %d"
+       comm = trace_find_cmdline(pid);
+
+       return trace_seq_printf(s, "\n------------8<---------- thread %s-%d"
                                    " ------------8<----------\n\n",
-                                 pid);
+                                   comm, pid);
 }
 
 static enum print_line_t