Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mathieu.desnoyers@efficios.com (Mathieu Desnoyers)
Subject: [lttng-dev] Writing a babeltrace output plugin
Date: Tue, 17 Apr 2012 11:05:58 -0400	[thread overview]
Message-ID: <20120417150558.GA31475@Krystal> (raw)
In-Reply-To: <524C960C5DFC794E82BE548D825F05CF29F0FE@EU-MBX-04.mgc.mentorg.com>

* Oestman, Fredrik (Fredrik_Oestman at mentor.com) wrote:
> Mathieu Desnoyers wrote:
> > The second solution is to look at include/babeltrace/ctf-ir/metadata.h
> > in-tree, and include/babeltrace/types.h (also in-tree). Those files
> > contain almost all the metadata of the CTF trace read, so you should be
> > able to extract your own metadata from those.
> 
> Is there a special reason that the field names in the metadata are
> prefixed with an underscore?

Yes, prefixing the field names is an oddness caused by the need to not
have ambiguity between field names declared within the local scope and
root scope names (event, stream, env, trace).

Lets assume we have a field called "stream" within an event (I am not
saying this should be done, I'm just saying this kind of thing happens
to be done automatically by the tracer, depending on the instrumentation
sources):

  uint32_t stream;

Followed by a sequence that refers to it:

  uint8_t myfield2[stream];

It is ambiguous whether "stream" should refer to the "stream" in the
local scope, or the toplevel "stream" dynamic scope as in:

(7.3.2 Static and Dynamic Scopes from CTF spec)

"The dynamic scope prefixes are thus:

 - Trace Environment: <env. >,
 - Trace Packet Header: <trace.packet.header. >,
 - Stream Packet Context: <stream.packet.context. >,
 - Event Header: <stream.event.header. >,
 - Stream Event Context: <stream.event.context. >,
 - Event Context: <event.context. >,
 - Event Payload: <event.fields. >."

This applies to both sequence and variant types, which both need to
refer to another field. The sequence for the length, the variant for the
"choice" selection (an enumeration).

The ideas I pondered were either to change the grammar late in the game
and prefix a dot (".") before any toplevel dynamic scope, or make the
LTTng tracer preprend an underscore before each event field, which gets
removed by the trace analyzer.

I'm not particularly proud of this hack though. Comments are welcome.

Thanks,

Mathieu

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com



  reply	other threads:[~2012-04-17 15:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-03 10:55 [lttng-dev] Babeltrace ctf-text duplicated error message Oestman, Fredrik
2012-04-03 11:35 ` [lttng-dev] Writing a babeltrace output plugin Oestman, Fredrik
2012-04-03 12:57   ` Mathieu Desnoyers
2012-04-03 13:31     ` Oestman, Fredrik
2012-04-03 13:33       ` Mathieu Desnoyers
2012-04-03 13:34         ` Mathieu Desnoyers
2012-04-03 14:06           ` Oestman, Fredrik
2012-04-03 14:10             ` Mathieu Desnoyers
2012-04-03 14:21               ` Julien Desfossez
2012-04-04  7:00                 ` Oestman, Fredrik
2012-04-17  6:57     ` Oestman, Fredrik
2012-04-17 15:05       ` Mathieu Desnoyers [this message]
2012-04-17 15:30         ` Alexandre Montplaisir
2012-04-17 15:44           ` Matthew Khouzam
2012-04-17 15:48           ` Mathieu Desnoyers
2012-04-03 12:53 ` [lttng-dev] Babeltrace ctf-text duplicated error message Mathieu Desnoyers

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=20120417150558.GA31475@Krystal \
    --to=mathieu.desnoyers@efficios.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