aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2008-11-26 00:16:26 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-26 00:52:56 -0500
commit660c7f9be96321fc80026d76411bd15e6f418a72 (patch)
tree5ae61fa51c9e9ce7b42f64cfaa168cd09439ac3d /kernel/trace
parente53a6319cca69111c1643dc9f18f4465d7f1cbf0 (diff)
ftrace: add thread comm to function graph tracer
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>
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace.c2
-rw-r--r--kernel/trace/trace.h1
-rw-r--r--kernel/trace/trace_functions_graph.c21
3 files changed, 18 insertions, 6 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 9d5f7c94f251..5811e0a5f732 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -804,7 +804,7 @@ static void trace_save_cmdline(struct task_struct *tsk)
804 spin_unlock(&trace_cmdline_lock); 804 spin_unlock(&trace_cmdline_lock);
805} 805}
806 806
807static char *trace_find_cmdline(int pid) 807char *trace_find_cmdline(int pid)
808{ 808{
809 char *cmdline = "<...>"; 809 char *cmdline = "<...>";
810 unsigned map; 810 unsigned map;
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index ffe1bb1eb620..7adacf349ef7 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -450,6 +450,7 @@ struct tracer_switch_ops {
450 struct tracer_switch_ops *next; 450 struct tracer_switch_ops *next;
451}; 451};
452 452
453char *trace_find_cmdline(int pid);
453#endif /* CONFIG_CONTEXT_SWITCH_TRACER */ 454#endif /* CONFIG_CONTEXT_SWITCH_TRACER */
454 455
455#ifdef CONFIG_DYNAMIC_FTRACE 456#ifdef CONFIG_DYNAMIC_FTRACE
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index b6f0cc2a00cb..bbb81e7b6c40 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -32,29 +32,40 @@ static pid_t last_pid = -1;
32 32
33static int graph_trace_init(struct trace_array *tr) 33static int graph_trace_init(struct trace_array *tr)
34{ 34{
35 int cpu; 35 int cpu, ret;
36
36 for_each_online_cpu(cpu) 37 for_each_online_cpu(cpu)
37 tracing_reset(tr, cpu); 38 tracing_reset(tr, cpu);
38 39
39 return register_ftrace_graph(&trace_graph_return, 40 ret = register_ftrace_graph(&trace_graph_return,
40 &trace_graph_entry); 41 &trace_graph_entry);
42 if (ret)
43 return ret;
44 tracing_start_cmdline_record();
45
46 return 0;
41} 47}
42 48
43static void graph_trace_reset(struct trace_array *tr) 49static void graph_trace_reset(struct trace_array *tr)
44{ 50{
45 unregister_ftrace_graph(); 51 tracing_stop_cmdline_record();
52 unregister_ftrace_graph();
46} 53}
47 54
48/* If the pid changed since the last trace, output this event */ 55/* If the pid changed since the last trace, output this event */
49static int verif_pid(struct trace_seq *s, pid_t pid) 56static int verif_pid(struct trace_seq *s, pid_t pid)
50{ 57{
58 char *comm;
59
51 if (last_pid != -1 && last_pid == pid) 60 if (last_pid != -1 && last_pid == pid)
52 return 1; 61 return 1;
53 62
54 last_pid = pid; 63 last_pid = pid;
55 return trace_seq_printf(s, "\n------------8<---------- thread %d" 64 comm = trace_find_cmdline(pid);
65
66 return trace_seq_printf(s, "\n------------8<---------- thread %s-%d"
56 " ------------8<----------\n\n", 67 " ------------8<----------\n\n",
57 pid); 68 comm, pid);
58} 69}
59 70
60static enum print_line_t 71static enum print_line_t