From: Jiri Olsa <jolsa@redhat.com>
To: mingo@elte.hu, rostedt@goodmis.org, fweisbec@gmail.com
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@redhat.com>
Subject: [PATCH 4/4] tracing: raw output for graph tracer
Date: Mon, 22 Feb 2010 13:57:02 +0100 [thread overview]
Message-ID: <1266843422-18288-5-git-send-email-jolsa@redhat.com> (raw)
In-Reply-To: <1266843422-18288-1-git-send-email-jolsa@redhat.com>
hi,
this patch adds raw trace output for graph tracer.
I have this one around for long time and it was quite handy
for investigating graph tracer issues.
wbr,
jirka
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
kernel/trace/trace.c | 2 +-
kernel/trace/trace_functions_graph.c | 69 ++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 1 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 032c57c..723fa93 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1900,7 +1900,7 @@ static enum print_line_t print_raw_fmt(struct trace_iterator *iter)
entry = iter->ent;
if (trace_flags & TRACE_ITER_CONTEXT_INFO) {
- if (!trace_seq_printf(s, "%d %d %llu ",
+ if (!trace_seq_printf(s, " %6d %3d %20llu ",
entry->pid, iter->cpu, iter->ts))
goto partial;
}
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index eca09b3..023e0be 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -1033,6 +1033,66 @@ print_graph_function(struct trace_iterator *iter, int flags)
return TRACE_TYPE_HANDLED;
}
+static enum print_line_t
+print_graph_raw(struct trace_iterator *iter, int flags)
+{
+ struct trace_entry *entry = iter->ent;
+ struct trace_seq *s = &iter->seq;
+ int ret = 0;
+ int depth;
+ void *func;
+ char *io;
+
+ switch (entry->type) {
+ case TRACE_GRAPH_ENT: {
+ struct ftrace_graph_ent_entry *field;
+ trace_assign_type(field, entry);
+ depth = field->graph_ent.depth;
+ func = (void *) field->graph_ent.func;
+ io = "-->";
+ break;
+ }
+ case TRACE_GRAPH_RET: {
+ struct ftrace_graph_ret_entry *field;
+ trace_assign_type(field, entry);
+ depth = field->ret.depth;
+ func = (void *) field->ret.func;
+ io = "<--";
+ break;
+ }
+ default:
+ return print_graph_comment(s, entry, iter);
+ }
+
+ ret = trace_seq_printf(s, "%s%6d %6d %6d %4d %7d %20p %4s %ps\n",
+ trace_flags & TRACE_ITER_CONTEXT_INFO ? "" : " ",
+ depth,
+ entry->lock_depth,
+ entry->flags,
+ entry->preempt_count,
+ entry->pid,
+ entry,
+ io,
+ func);
+
+ if (!ret)
+ return TRACE_TYPE_PARTIAL_LINE;
+
+ return TRACE_TYPE_HANDLED;
+}
+
+static void print_graph_raw_header(struct seq_file *s)
+{
+ if (trace_flags & TRACE_ITER_CONTEXT_INFO)
+ seq_printf(s, "#%6s %3s %20s ", "pid", "cpu", "duration");
+ else
+ seq_printf(s, "#");
+
+ seq_printf(s, "%6s %6s %6s %4s %7s %20s %4s %s\n",
+ "depth", "ldepth", "flags", "pc", "pid",
+ "entry", "i/o", "function");
+}
+
static void print_lat_header(struct seq_file *s)
{
static const char spaces[] = " " /* 16 spaces */
@@ -1059,6 +1119,11 @@ void print_graph_headers(struct seq_file *s)
{
int lat = trace_flags & TRACE_ITER_LATENCY_FMT;
+ if (trace_flags & TRACE_ITER_RAW) {
+ print_graph_raw_header(s);
+ return;
+ }
+
if (lat)
print_lat_header(s);
@@ -1074,6 +1139,7 @@ void print_graph_headers(struct seq_file *s)
seq_printf(s, "|||||");
if (tracer_flags.val & TRACE_GRAPH_PRINT_DURATION)
seq_printf(s, " DURATION ");
+
seq_printf(s, " FUNCTION CALLS\n");
/* 2nd line */
@@ -1136,14 +1202,17 @@ void graph_trace_close(struct trace_iterator *iter)
}
}
+
static struct trace_event graph_trace_entry_event = {
.type = TRACE_GRAPH_ENT,
.trace = print_graph_function,
+ .raw = print_graph_raw,
};
static struct trace_event graph_trace_ret_event = {
.type = TRACE_GRAPH_RET,
.trace = print_graph_function,
+ .raw = print_graph_raw,
};
static struct tracer graph_trace __read_mostly = {
--
1.6.6
next prev parent reply other threads:[~2010-02-22 12:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-22 12:56 [PATCH 0/4] tracing: function graph output for preempt/irqs-off tracers Jiri Olsa
2010-02-22 12:56 ` [PATCH 1/4] tracing: adding ftrace events for graph tracer Jiri Olsa
2010-03-08 19:29 ` Steven Rostedt
2010-03-09 15:15 ` Jiri Olsa
2010-02-22 12:57 ` [PATCH 2/4] tracing: graph output support for irqsoff tracer Jiri Olsa
2010-02-22 12:57 ` [PATCH 3/4] tracing: graph output support for preemptirqsoff/preemptoff tracers Jiri Olsa
2010-02-22 12:57 ` Jiri Olsa [this message]
2010-03-08 7:07 ` [PATCH 0/4] tracing: function graph output for preempt/irqs-off tracers Jiri Olsa
2010-03-08 15:11 ` 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=1266843422-18288-5-git-send-email-jolsa@redhat.com \
--to=jolsa@redhat.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
/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;
as well as URLs for NNTP newsgroup(s).