From: Pekka Paalanen <pq@iki.fi>
To: "Steven Rostedt" <rostedt@goodmis.org>
Cc: "Frédéric Weisbecker" <fweisbec@gmail.com>,
"Ingo Molnar" <mingo@elte.hu>,
"Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: [Patch] Tracing/ftrace: Adds a marker to allow user comments
Date: Sun, 7 Sep 2008 17:11:43 +0300 [thread overview]
Message-ID: <20080907171143.3acdbedd@daedalus.pq.iki.fi> (raw)
In-Reply-To: <20080904203058.7e57729e@daedalus.pq.iki.fi>
Steven,
is there a logic behind trace_seq_print_cont() printing the terminating
newline only, when there actually is no TRACE_CONT entry?
Hmm, wait a minute, I don't understand how this thing works at all.
Let's take for instance print_lat_fmt() which is the first user of
trace_seq_print_cont(). Now, print_lat_fmt() does
struct trace_entry *entry = iter->ent;
and uses 'entry'. Let's assume it is of type TRACE_PRINT. It does
case TRACE_PRINT:
seq_print_ip_sym(s, field->print.ip, sym_flags);
trace_seq_printf(s, ": %s", field->print.buf);
if (field->flags & TRACE_FLAG_CONT)
trace_seq_print_cont(s, iter);
break;
Ok, it prints the beginning of the message, and if there should be
continuation blocks, it calls trace_seq_print_cont(), defined as
follows:
static void
trace_seq_print_cont(struct trace_seq *s, struct trace_iterator *iter)
{
struct trace_array *tr = iter->tr;
struct trace_array_cpu *data = tr->data[iter->cpu];
struct trace_entry *ent;
ent = trace_entry_idx(tr, data, iter, iter->cpu);
if (!ent || ent->type != TRACE_CONT) {
trace_seq_putc(s, '\n');
return;
}
do {
trace_seq_printf(s, "%s", ent->cont.buf);
__trace_iterator_increment(iter, iter->cpu);
ent = trace_entry_idx(tr, data, iter, iter->cpu);
} while (ent && ent->type == TRACE_CONT);
}
Here it uses trace_entry_idx() to get 'ent'. What's the difference to
iter->ent? I don't understand how trace_entry_idx() works, but looking
at how it is used, it must return the pointer to the *next* entry in
the ring buffer. So I don't understand the name of the function, and I
don't see a call to __trace_iterator_increment(), which is confusing.
If contrary to the assumption, 'ent' is not a continuation, it prints
the terminating newline. This is an exceptional case, as the original
entry was marked as having continuation entries.
The normal case then is to execute the do-while, until it hits a
non-continuation entry. Here it does *not* print the terminating newline.
Steven, could you explain what is going on here?
Thanks.
On Thu, 4 Sep 2008 20:30:58 +0300
Pekka Paalanen <pq@iki.fi> wrote:
> b) have a customisable trace_seq_print_cont()
>
> I think I'd favour b). When I tried to use trace_seq_print_cont(),
> I found it difficult to control the printing of \n at the end of
> message. So I would implement my own routine to handle also what
> trace_seq_print_cont() does, filtering the text while copying it
> to struct trace_seq. I'm not sure where this function should live.
> It could be useful to all tracers, that want "one line per marker
> entry" style output, so it could live in trace.c.
--
Pekka Paalanen
http://www.iki.fi/pq/
next prev parent reply other threads:[~2008-09-07 14:12 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-24 21:42 Frédéric Weisbecker
2008-08-25 8:44 ` Ingo Molnar
2008-08-25 13:59 ` Frédéric Weisbecker
2008-08-25 16:38 ` Steven Rostedt
2008-08-25 17:52 ` Frédéric Weisbecker
2008-08-27 9:59 ` Frédéric Weisbecker
2008-08-27 18:21 ` Pekka Paalanen
2008-08-28 9:44 ` Ingo Molnar
2008-08-28 16:03 ` Frédéric Weisbecker
2008-08-28 10:04 ` Frédéric Weisbecker
2008-08-28 18:42 ` Pekka Paalanen
2008-09-04 16:20 ` Frédéric Weisbecker
2008-09-04 17:30 ` Pekka Paalanen
2008-09-04 18:11 ` Steven Rostedt
2008-09-06 11:39 ` Frédéric Weisbecker
2008-09-06 13:49 ` Pekka Paalanen
2008-09-15 19:47 ` Tracing/ftrace: trouble with trace_entries and trace_pipe Pekka Paalanen
2008-09-15 21:14 ` Steven Rostedt
2008-09-16 18:01 ` Pekka Paalanen
2008-09-17 12:41 ` Frédéric Weisbecker
2008-09-17 17:36 ` Pekka Paalanen
2008-09-16 18:54 ` [PATCH 1/7] x86 mmiotrace: fix a rare memory leak Pekka Paalanen
2008-09-16 18:56 ` [PATCH 2/7] ftrace: move mmiotrace functions out of trace.c Pekka Paalanen
2008-09-16 18:58 ` [PATCH 3/7] ftrace: add trace_vprintk() Pekka Paalanen
2008-09-16 20:06 ` Steven Rostedt
2008-09-17 11:42 ` Ingo Molnar
2008-09-16 19:00 ` [PATCH 4/7] x86 mmiotrace: implement mmiotrace_printk() Pekka Paalanen
2008-09-16 19:02 ` [PATCH 5/7] mmiotrace: handle TRACE_PRINT entries Pekka Paalanen
2008-09-16 20:11 ` Steven Rostedt
2008-09-16 21:24 ` Pekka Paalanen
2008-09-16 19:03 ` [PATCH 6/7] mmiotrace: remove left-over marker cruft Pekka Paalanen
2008-09-16 19:06 ` [PATCH 7/7] ftrace: inject markers via trace_marker file Pekka Paalanen
2008-09-16 8:57 ` Tracing/ftrace: trouble with trace_entries and trace_pipe Frédéric Weisbecker
2008-09-07 14:11 ` Pekka Paalanen [this message]
2008-09-07 17:29 ` [Patch] Tracing/ftrace: Adds a marker to allow user comments Steven Rostedt
2008-09-08 17:19 ` Pekka Paalanen
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=20080907171143.3acdbedd@daedalus.pq.iki.fi \
--to=pq@iki.fi \
--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
all inboxes | Powered by JetHome®