Re: [PATCH -tip] tracing: use defined fields to print formats

From: Steven Rostedt
Date: Mon Jul 20 2009 - 13:26:19 EST



On Thu, 16 Jul 2009, Lai Jiangshan wrote:

>
> It seems that ftrace_format_##call() and ftrace_define_fields_##call()
> are duplicate more or less.
>
> trace_define_field() defines fields and links them into
> strcut ftrace_event_call. We reuse them to print formats
> and remove ftrace_format_##call(). It make all things simpler.
>
> TRACE_EVENT_FORMAT_NOFILTER is dropped. Because we should
> "trace_define_field()" fields for all struct ftrace_event_call,
> even it's no filter.

OK, I added this and did a diff of the formats before this patch and
after the patch. Here they are (with a lot of duplicats cut out).

[
'<' represents the old format
'>' represents the new format (with patch applied)
]

4c4
< field:unsigned short common_type; offset:0; size:2;
---
> field:int common_type; offset:0; size:2;

We changed the common type from "unsigned short" to "int"?

45,46c45,46
< field:char rwbs[6]; offset:32; size:6;
< field:char comm[TASK_COMM_LEN]; offset:38; size:16;
---
> field:char[6] rwbs; offset:32; size:6;
> field:char[TASK_COMM_LEN] comm; offset:38; size:16;

I have several parsers that expect the '[6]' to come after the
declaration.


390c390
< print fmt: "type:%u call_site:%lx ptr:%p"
---
> print fmt: type:%u call_site:%lx ptr:%p

The 'ftrace' events lost their quotes around the print format.

394c394
< field:unsigned short common_type; offset:0; size:2;
---
> field:unsigned char common_type; offset:0; size:2;

And the ftrace events also now use "unsigned char" for the common_type
instead of unsigned short?


408c408
< print fmt: "type:%u call_site:%lx ptr:%p req:%lu alloc:%lu flags:%x node:%d"
---
> print fmt: type:%u call_site:%lx ptr:%p req:%lu alloc:%lu flags:%x node:%d

423c423
< print fmt: "%llx->%llx type:%u state:%u"
---
> print fmt: %llx->%llx type:%u state:%u

436c436
< print fmt: "from: %llx to: %llx"
---
> print fmt: from: %llx to: %llx


Lots more quotes missing (I'll cut out the rest of the diff of quotes
missing).

447,448c447,448
< field special:char func[TRACE_FUNC_SIZE+1]; offset:16; size:31;
< field special:char file[TRACE_FUNC_SIZE+1]; offset:47; size:21;
---
> field:char func[TRACE_FUNC_SIZE+1][TRACE_FUNC_SIZE+1] func; offset:16; size:31;
> field:char file[TRACE_FUNC_SIZE+1][TRACE_FUNC_SIZE+1] file; offset:47; size:21;

This is interesting.


>
> Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>

I really like the clean up this patch does, but it must not modify the
current format of the files unless there is a really good reason to do so.

Thanks,

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/