From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: "Frédéric Weisbecker" <fweisbec@gmail.com>,
"Ingo Molnar" <mingo@elte.hu>, Zhaolei <zhaolei@cn.fujitsu.com>,
"Tom Zanussi" <tzanussi@gmail.com>,
"Li Zefan" <lizf@cn.fujitsu.com>,
"KOSAKI Motohiro" <kosaki.motohiro@jp.fujitsu.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2 v2] tracing/events: provide string with undefined size support
Date: Fri, 17 Apr 2009 12:39:34 +0200 [thread overview]
Message-ID: <1239964774.23397.4363.camel@laptop> (raw)
In-Reply-To: <alpine.DEB.2.00.0904170552160.20429@gandalf.stny.rr.com>
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 ;-)
next prev parent reply other threads:[~2009-04-17 10:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-16 20:00 [PATCH 1/2 v2] tracing/events: provide string with undefined size support Frederic Weisbecker
2009-04-16 20:00 ` [PATCH 2/2 v2] tracing/lock: provide lock_acquired event support for dynamic size string Frederic Weisbecker
2009-04-16 20:13 ` [PATCH 1/2 v2] tracing/events: provide string with undefined size support Peter Zijlstra
2009-04-16 20:28 ` Frédéric Weisbecker
2009-04-17 6:22 ` Peter Zijlstra
2009-04-17 8:59 ` Frédéric Weisbecker
2009-04-17 9:29 ` Peter Zijlstra
2009-04-17 10:04 ` Frédéric Weisbecker
2009-04-17 10:07 ` Frédéric Weisbecker
2009-04-17 10:10 ` Steven Rostedt
2009-04-17 10:16 ` Frédéric Weisbecker
2009-04-17 10:39 ` Peter Zijlstra [this message]
2009-04-17 10:51 ` Steven Rostedt
2009-04-17 11:14 ` Frédéric Weisbecker
2009-04-17 10:39 ` Steven Rostedt
2009-04-18 18:42 ` Frederic Weisbecker
2009-04-19 0:52 ` 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=1239964774.23397.4363.camel@laptop \
--to=a.p.zijlstra@chello.nl \
--cc=fweisbec@gmail.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.com \
--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