From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Andrew Morton <akpm@linux-foundation.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
containers@lists.osdl.org,
Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
"Serge E. Hallyn" <serue@us.ibm.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 4/5] ftrace: add thread comm to function graph tracer
Date: Wed, 26 Nov 2008 00:16:26 -0500 [thread overview]
Message-ID: <20081126051710.149585354@goodmis.org> (raw)
In-Reply-To: 20081126051622.134970943@goodmis.org
[-- Attachment #1: 0004-ftrace-add-thread-comm-to-function-graph-tracer.patch --]
[-- Type: text/plain, Size: 2458 bytes --]
From: Steven Rostedt <rostedt@goodmis.org>
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>
---
kernel/trace/trace.c | 2 +-
kernel/trace/trace.h | 1 +
kernel/trace/trace_functions_graph.c | 21 ++++++++++++++++-----
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 9d5f7c9..5811e0a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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;
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index ffe1bb1..7adacf3 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -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
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index b6f0cc2..bbb81e7 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;
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
--
1.5.6.5
--
next prev parent reply other threads:[~2008-11-26 5:16 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-26 5:16 [PATCH 0/5] ftrace: rebase patches on top of tip/master + some extras Steven Rostedt
2008-11-26 5:16 ` [PATCH 1/5] ftrace: add function tracing to single thread Steven Rostedt
2008-11-26 5:29 ` Andrew Morton
2008-11-26 16:43 ` Steven Rostedt
2008-11-26 6:42 ` Eric W. Biederman
2008-11-26 6:54 ` Ingo Molnar
2008-11-26 16:55 ` Steven Rostedt
2008-11-26 16:54 ` Steven Rostedt
2008-11-26 5:16 ` [PATCH 2/5] ftrace: use code patching for ftrace graph tracer Steven Rostedt
[not found] ` <20081126051709.774546196-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org>
2008-11-26 5:35 ` Andrew Morton
2008-11-26 6:52 ` Harvey Harrison
2008-11-26 8:04 ` Andrew Morton
2008-11-26 8:27 ` Harvey Harrison
2008-11-26 8:35 ` Andrew Morton
[not found] ` <20081126003553.12d38150.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2008-11-26 8:44 ` Harvey Harrison
2008-11-26 9:05 ` Andrew Morton
2008-11-26 9:22 ` Harvey Harrison
2008-11-26 16:46 ` Steven Rostedt
2008-11-26 18:02 ` Andrew Morton
2008-11-26 18:06 ` Harvey Harrison
2008-11-26 5:16 ` [PATCH 3/5] ftrace: let function tracing and function return run together Steven Rostedt
2008-11-26 5:16 ` Steven Rostedt [this message]
2008-11-26 5:37 ` [PATCH 4/5] ftrace: add thread comm to function graph tracer Andrew Morton
2008-11-26 16:48 ` Steven Rostedt
2008-11-26 18:04 ` Andrew Morton
2008-11-26 5:16 ` [PATCH 5/5] ftrace: add cpu annotation for " Steven Rostedt
2008-11-26 5:39 ` Andrew Morton
2008-11-26 5:47 ` Ingo Molnar
2008-11-26 5:55 ` Andrew Morton
2008-11-26 16:49 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081126051710.149585354@goodmis.org \
--to=rostedt@goodmis.org \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.osdl.org \
--cc=ebiederm@xmission.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=serue@us.ibm.com \
--cc=srostedt@redhat.com \
--cc=sukadev@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox