[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0904170649130.20429@gandalf.stny.rr.com>
Date: Fri, 17 Apr 2009 06:51:45 -0400 (EDT)
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
cc: Frédéric Weisbecker <fweisbec@...il.com>,
Ingo Molnar <mingo@...e.hu>, Zhaolei <zhaolei@...fujitsu.com>,
Tom Zanussi <tzanussi@...il.com>,
Li Zefan <lizf@...fujitsu.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2 v2] tracing/events: provide string with undefined
size support
On Fri, 17 Apr 2009, Peter Zijlstra wrote:
> On Fri, 2009-04-17 at 06:10 -0400, Steven Rostedt wrote:
>
> > When I replied to Frederic, I thought I could come up with a way to do
> > something like you are proposing. Instead, I only ended up with the
> > variant that Frederic implemented.
> >
> > I've done what you are suggesting several times in tracing. Logdev does
> > this in its tracing.
> >
> > The problem that we have, is that we don't have actual code. We have a
> > TRACE_EVENT macro that is doing the work for us. This, unfortunately,
> > limits what we can do.
>
> Can't you do things like:
>
> #define __string(x) unsigned long length_##x, offset_##x;
>
> TP_STRUCT__entry
>
> size = sizeof(struct foo);
>
> #define __string(x) length_##x = strlen(x) + 1; size += length_##x;
>
> TP_STRUCT__entry
>
> entry = ring_buffer_lock_reserve(size);
> offset = sizeof(stuct foo);
>
> #define __string(x) \
> __entry->x = offset_##x = offset; offset += length_##x;
>
> TP_STRUCT__entry
>
> TP_fast_assign
>
> #define _string(x) strcpy(&entry->data[offset_##x], x);
>
> TP_STRUCT__entry
>
> ring_buffer_unlock();
>
> also, you don't need that __ending_string() thing, you can always end a
> struct with char data[0], its 0 size ;-)
>
This looks very similar to what I suggested in the cross email.
Frederic,
You want to take a crack at implementing this. I think my description had
a bit more details, but is basically the same as what Peter is describing
here.
I'd just make __string become an offset (as described in my email)
Then the user could just index directly. They only need to worry about the
print, the assignment would be automated.
-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists