From: "Frédéric Weisbecker" <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Christoph Hellwig <hch@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Minchan Kim <minchan.kim@gmail.com>, Mel Gorman <mel@csn.ul.ie>,
Rik van Riel <riel@redhat.com>,
Pekka Enberg <penberg@cs.helsinki.fi>,
Peter Zijlstra <peterz@infradead.org>,
Theodore Tso <tytso@mit.edu>,
Mathieu Desnoyers <compudj@krystal.dyndns.org>,
Lai Jiangshan <laijs@cn.fujitsu.com>,
Zhaolei <zhaolei@cn.fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Jason Baron <jbaron@redhat.com>,
Jiaying Zhang <jiayingz@google.com>
Subject: Re: [RFC PATCH 2/5] tracing/events: nicer print format for parsing
Date: Wed, 10 Jun 2009 13:51:43 +0200 [thread overview]
Message-ID: <c62985530906100451n7972e1f2q2ade3ac72c29f249@mail.gmail.com> (raw)
In-Reply-To: <c62985530906100431g4ceab378w55250e50219f4650@mail.gmail.com>
Le 10 juin 2009 13:31, Frédéric Weisbecker<fweisbec@gmail.com> a écrit :
> 2009/6/10 Ingo Molnar <mingo@elte.hu>:
>>
>> * Christoph Hellwig <hch@infradead.org> wrote:
>>
>>> On Tue, Jun 09, 2009 at 09:22:01PM +0200, Frederic Weisbecker wrote:
>>> > But I wonder if the above new language is not breaking the charm
>>> > of the TRACE_EVENT(), which charm is that it's easy to implement (hopefully).
>>> >
>>> > Everyone knows the printk formats. And I guess this new thing is
>>> > easy and quick to learn. But because it's a new unknown
>>> > language, the TRACE_EVENT will become less readable, less
>>> > reachable for newcomers in TRACE_EVENT.
>>>
>>> I must also say I don't particularly like it. printk is nice and
>>> easy an everybody knows it, but it's not quite flexible enough as
>>> we might have to do all kinds of conversions on the reader side.
>>> What might be a better idea is to just have C function pointer for
>>> output conversions that could be put into the a file in debugfs
>>> and used by the binary trace buffer reader. Or maybe not as we
>>> would pull in too many depenencies.
>>
>> Another bigger problem with the new tag format, beyond introducing
>> an arbitrary descriptor language (which is easy to mess up) is the
>> loss of type checking.
>>
>> With the tags the field printouts can go stray easily - while with
>> TP_printk() we had printf type checking. (which, as imperfect as it
>> may be to specify a format, does create a real connection between
>> the record and the output format specification.)
>>
>>> I think we should go with the printk solution for 2.6.31 and use
>>> the full development cycle for 2.6.32 to come up with something
>>> better.
>>>
>>> As soon as a couple of large subsystems use the even tracer we
>>> also have a broader base examples to see how new syntax works on
>>> them.
>>
>> I think much of the tooling problem could be solved with a little
>> trick: the format string can be injected into an artificial .c file
>> (runtime), and the tool could compile that .c file (in user-space)
>> and get access to the result.
>>
>> For example, one of the more complex block tracepoints,
>> /debug/tracing/events/block/block_bio_backmerge:
>>
>> print fmt: "%d,%d %s %llu + %u [%s]", ((unsigned int) ((REC->dev) >>
>> 20)), ((unsigned int) ((REC->dev) & ((1U << 20) - 1))), REC->rwbs,
>> (unsigned long long)REC->sector, REC->nr_sector, REC->comm
>>
>> when pasted verbatim into the stub below, produces:
>>
>> 0,6 a 7 + 8 [abc]
>>
>> Note that i pasted the format string into the code below unchanged,
>> and i used the format descriptor to create the record type. (this
>> too is easy to automate).
>>
>> If this is generated into the following function:
>>
>> format_block_bio_backmerge(struct record *rec);
>>
>> and a small dynamic library is built out of it, tooling can use
>> dlopen() to load those format printing stubs.
>>
>> It's all pretty straightforward and can be used for arbitrarily
>> complex formats.
>
>
>
> Hmm
>
>
>
>> And i kind of like the whole notion on a design level as weell: the
>> kernel exporting C source code for tools :-)
>>
>> Ingo
>>
>> ------------------>
>>
>> struct record {
>> unsigned short common_type;
>> unsigned char common_flags;
>> unsigned char common_preempt;
>> int common_pid;
>> int common_tgid;
>> int dev;
>> unsigned long long sector;
>> unsigned int nr_sector;
>> char rwbs[6];
>> char comm[16];
>> } this_record = { 1, 2, 3, 4, 5, 6, 7, 8, { 'a', }, "abc" };
>>
>> void main(void)
>> {
>> struct record *REC = &this_record;
>>
>> printf("%d,%d %s %llu + %u [%s]", ((unsigned int) ((REC->dev) >> 20)), ((unsigned int) ((REC->dev) & ((1U << 20) - 1))), REC->rwbs, (unsigned long long)REC->sector, REC->nr_sector, REC->comm);
>> }
>
>
> Yeah it's a quite nice idea.
> But it's assuming everyone parses binary files using C programs.
> Usually, such parsing
> more likely involves the use of scripting languages.
>
While thinking more about it your idea can produce a whole parser
automatically and dynamically written.
So actually, looks like a right direction :-)
next prev parent reply other threads:[~2009-06-10 11:51 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-09 1:45 [RFC PATCH 0/5] simplify the print fmt in the event format files Steven Rostedt
2009-06-09 1:45 ` [RFC PATCH 1/5] tracing: add trace_seq_vprint interface Steven Rostedt
2009-06-09 1:45 ` [RFC PATCH 2/5] tracing/events: nicer print format for parsing Steven Rostedt
2009-06-09 19:22 ` Frederic Weisbecker
2009-06-09 19:45 ` Steven Rostedt
2009-06-09 20:01 ` Mathieu Desnoyers
2009-06-10 1:59 ` Lai Jiangshan
2009-06-10 5:37 ` Steven Rostedt
2009-06-10 9:37 ` Christoph Hellwig
2009-06-10 9:48 ` Christoph Hellwig
2009-06-10 10:11 ` Ingo Molnar
2009-06-10 11:31 ` Frédéric Weisbecker
2009-06-10 11:51 ` Frédéric Weisbecker [this message]
2009-06-10 12:18 ` Steven Rostedt
2009-06-10 17:16 ` Ingo Molnar
2009-06-10 17:56 ` Steven Rostedt
2009-06-10 18:39 ` [PATCH][GIT PULL] tracing: do not translate event helper macros in print format Steven Rostedt
2009-06-10 20:48 ` Ingo Molnar
2009-06-11 12:52 ` Christoph Hellwig
2009-06-11 13:04 ` Steven Rostedt
2009-06-10 14:32 ` [RFC PATCH 2/5] tracing/events: nicer print format for parsing Mathieu Desnoyers
2009-06-10 12:47 ` Steven Rostedt
2009-06-09 1:45 ` [RFC PATCH 3/5] tracing/events: modify irq print to new format Steven Rostedt
2009-06-10 9:42 ` Christoph Hellwig
2009-06-10 12:23 ` Steven Rostedt
2009-06-09 1:45 ` [RFC PATCH 4/5] tracing/events: modify sched " Steven Rostedt
2009-06-09 1:45 ` [RFC PATCH 5/5] tracing/events: modify kmem " Steven Rostedt
2009-06-09 7:12 ` Peter Zijlstra
2009-06-09 8:06 ` Mel Gorman
2009-06-09 13:08 ` Steven Rostedt
2009-06-09 12:07 ` [RFC PATCH 0/5] simplify the print fmt in the event format files Ingo Molnar
2009-06-09 12:57 ` 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=c62985530906100451n7972e1f2q2ade3ac72c29f249@mail.gmail.com \
--to=fweisbec@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=compudj@krystal.dyndns.org \
--cc=hch@infradead.org \
--cc=jbaron@redhat.com \
--cc=jiayingz@google.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=minchan.kim@gmail.com \
--cc=mingo@elte.hu \
--cc=penberg@cs.helsinki.fi \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tytso@mit.edu \
--cc=zhaolei@cn.fujitsu.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
all inboxes | Powered by JetHome®