From: Philippe Proulx <pproulx@efficios.com>
To: "Jérémie Galarneau" <jeremie.galarneau@efficios.com>
Cc: diamon-discuss <diamon-discuss@lists.linuxfoundation.org>,
lttng-dev <lttng-dev@lists.lttng.org>,
tracecompass-dev <tracecompass-dev@eclipse.org>,
etienne bergeron <etienne.bergeron@gmail.com>,
francois doray <francois.doray@gmail.com>
Subject: Re: [diamon-discuss] [lttng-dev] CTF2-PROP-1.0: Proposal for a major revision of the Common Trace Format, version 1.8
Date: Sat, 5 Nov 2016 00:09:53 +0000 (UTC) [thread overview]
Message-ID: <1844854267.16314.1478304593843.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <CA+jJMxt82o_nXR9AvdzfSU+eAEm2NiM8HfQUM9bP9Su=Dddr-w@mail.gmail.com>
----- Original Message -----
> From: "Jérémie Galarneau" <jeremie.galarneau@efficios.com>
> To: "Philippe Proulx" <pproulx@efficios.com>
> Cc: "diamon-discuss" <diamon-discuss@lists.linuxfoundation.org>, "lttng-dev" <lttng-dev@lists.lttng.org>,
> "tracecompass-dev" <tracecompass-dev@eclipse.org>, "etienne bergeron" <etienne.bergeron@gmail.com>, "francois doray"
> <francois.doray@gmail.com>
> Sent: Friday, 4 November, 2016 19:35:40
> Subject: Re: [lttng-dev] CTF2-PROP-1.0: Proposal for a major revision of the Common Trace Format, version 1.8
> On 25 October 2016 at 14:26, Philippe Proulx <pproulx@efficios.com> wrote:
>> .Minimal enumeration field type
>> ====
>> JSON representation:
>>
>> [source,json]
>> {
>> "field-type": "enum",
>> "members": {
>> "": [0]
>> }
>> }
>> ====
>
> Hi,
>
> A short comment/feature request with regards to enumerations.
>
> The CTF 1.8.2 spec states that:
> "Overlapping ranges within a single enumeration are implementation defined."
>
> I am currently trying to instrument code where a "command" flag has
> possible values that are determined at build time. Some of them may
> have different values and/or not exist depending on various build
> configuration options.
>
> To work around this, I am trying to define an enumeration of the form
>
> enum my_thingy_commands {
> UNKNOWN_CMD = 0..UINT_MAX,
> FOOIFY = 0,
> BARIFY = 1,
> #ifdef SOME_CONFIG
> LOLIFY = 2,
> #endif
> YOU_GET_IT_IFY = 3,
> };
>
> rather than explicitly "filling-in" every hole between defined values
> for this particular build config.
>
> I think a default value attribute would be helpful here rather than
> leaving this to be implementation defined.
>
> Is a recommendation of what to present when overlapping ranges are
> encountered beyond the scope of this spec?
> In the case of a default value, the course of action is pretty clear
> (prefer the "overriding" value, otherwise present the default). What
> to do with explicit overlaps is a bit more... interesting... from a UX
> standpoint (but they may have use cases ?).
>
> In fact, are overlapping enums addressed at all in CTF 2.x?
A default label is a good idea, and pretty straightforward to support
for a consumer:
{
"field-type": "enum",
"alignment": 16,
"size": 32,
"signed": true,
"default-label": "SOMETHING ELSE",
"members": {
"NEW": [0],
"TERMINATED": [-1],
"READY": [2, 17],
"RUNNING": [-3],
"WAITING": [
{"lower": 19, "upper": 199},
1000
],
"RESTARTING": [
{"base": 8, "value": "126674015"},
{"lower": -155, "upper": -98}
]
},
"user-attrs": {
"my-namespace": {
"my-attr": "desc"
}
}
}
As for overlapping ranges, they're not addressed in this proposal (they
should be). I'd be tempted to explicitly disallow them. I like this
simple one-to-many mapping. It's straightforward to implement, and it
simplifies the variant field type (otherwise we would need to specify
restrictions for an enumeration field type when referenced by at least
one variant field type).
We _could_ generalize this defaut label idea and support multiple
levels, but I don't think it's necessary. Something like:
0 --------------------------------------.
4 --------------------------. \
5 ---------------. \ \
22 -- BANANA > APPLE > ORANGE \
67 --------------' / \
82 -------------------------' > GRAPE
90 -------------. /
101 -- APPLE > AVOCADO /
122 ------------' /
127 -------------------------------------'
So:
* 2 is mapped to GRAPE
* 55 is mapped to APPLE
* 70 is mapped to ORANGE
* 85 is mapped to GRAPE
* 92 is mapped to AVOCADO
* 125 is mapped to GRAPE
Then the equivalent of your default label is the outermost range
(GRAPE).
Phil
>
> Regards,
> Jérémie
>
>>
>>
next prev parent reply other threads:[~2016-11-05 0:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-25 18:26 [diamon-discuss] CTF2-PROP-1.0: Proposal for a major revision of the Common Trace Format, version 1.8 Philippe Proulx
2016-10-26 15:32 ` [diamon-discuss] [lttng-dev] " Mathieu Desnoyers
2016-10-26 16:27 ` Mathieu Desnoyers
2016-10-26 16:27 ` Mathieu Desnoyers
2016-10-26 15:32 ` Mathieu Desnoyers
[not found] ` <2bd508fa-8bb0-e985-8453-da20431dd832@ericsson.com>
2016-10-28 0:08 ` [tracecompass-dev] " Philippe Proulx
2016-10-28 0:08 ` [diamon-discuss] " Philippe Proulx
2016-11-04 23:35 ` Jérémie Galarneau
2016-11-04 23:35 ` [diamon-discuss] [lttng-dev] " Jérémie Galarneau
2016-11-05 0:09 ` Philippe Proulx
2016-11-05 0:09 ` Philippe Proulx [this message]
2016-12-11 11:13 ` [diamon-discuss] [lttng-dev] " Jérémie Galarneau
2016-12-11 17:49 ` Philippe Proulx
2016-12-11 17:49 ` [diamon-discuss] [lttng-dev] " Philippe Proulx
2016-12-11 17:54 ` Jérémie Galarneau
2016-12-11 17:54 ` [diamon-discuss] [lttng-dev] " Jérémie Galarneau
2016-12-11 11:13 ` Jérémie Galarneau
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=1844854267.16314.1478304593843.JavaMail.zimbra@efficios.com \
--to=pproulx@efficios.com \
--cc=diamon-discuss@lists.linuxfoundation.org \
--cc=etienne.bergeron@gmail.com \
--cc=francois.doray@gmail.com \
--cc=jeremie.galarneau@efficios.com \
--cc=lttng-dev@lists.lttng.org \
--cc=tracecompass-dev@eclipse.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.