[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0904182050210.1016@gandalf.stny.rr.com>
Date: Sat, 18 Apr 2009 20:52:02 -0400 (EDT)
From: Steven Rostedt <rostedt@...dmis.org>
To: Frederic Weisbecker <fweisbec@...il.com>
cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
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 Sat, 18 Apr 2009, Frederic Weisbecker wrote:
> >
> > #undef __string
> > #define __string(str, param) __str_loc_##str = _str_size_; \
> > _str_size_ += strlen(param) + 1;
> >
> > #define TRACE_EVENT(...)
> > tstruct
> >
> > #include the file again
>
>
> While I'm trying to implement this, I'm discovering that it's
> impossible, unless we have only one TRACE_EVENT in the file we are
> including, otherwise we would end up with interleaving functions:
>
> static void ftrace_raw_event_event1(proto)
> {
> struct ring_buffer_event *event;
> struct ftrace_raw_event1 *entry;
> unsigned long flags;
> int pc;
> int _str_size_ = 0;
>
> tstruct
>
> static void ftrace_raw_event_event2(proto)
> {
> struct ring_buffer_event *event;
> struct ftrace_raw_event2 *entry;
> unsigned long flags;
> int pc;
> int _str_size_ = 0;
>
> tstruct
Ug, that's right.
>
>
> So we still need something inside the fast_assign to do the
> assignment job.
>
> Something like the following macro will suffice:
>
> #define __assign_string(field, src) \
> strcpy(entry->__ending_str + __str_loc_##field, src);
>
> That's not a big deal, we just actually need this in TP__fast_assign()
> and then we are done.
>
> And also:
>
>
> > The tstruct would do the assign for the user.
> >
> > Then this is what a TRACE_EVENT would look like:
> >
> > TRACE_EVENT(my_event,
> >
> > TP_PROTO(char *str1, char *str2, char *str3),
> >
> > TP_ARGS(str1, str2, str3),
> >
> > TP_STRUCT__entry(
> > __string(str1, str1)
> > __string(str2, str2)
> > __string(str3, str3)
> > ),
> >
> > TP_fast_assign(
> > /* empty, strings are automated */
> > ),
> >
> > TP_printk("str1:%s str2:%s str3:%s\n",
> > __entry->__str_data__ + __entry->str1,
> > __entry->__str_data__ + __entry->str2,
> > __entry->__str_data__ + __entry->str3)
>
>
>
> A simple macro here to simplify that for the users:
>
> #define __get_str(item) \
> __entry->__ending_str + __entry->__str_loc_#item
>
> would be much more convenient.
>
> Anyway, I'll submit it and will wait for your comments.
Sure, do what you think is needed. Make sure the change log has an
example that includes multiple strings.
Thanks,
-- 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