All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Geneviève Bastien" <gbastien+lttng@versatic.net>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: lttng-dev@lists.lttng.org
Subject: Re: [RFC Patch Ust 1/5] Update data structures to support CTF global structures
Date: Wed, 09 Apr 2014 13:29:14 -0400	[thread overview]
Message-ID: <5345836A.1090509__15174.1926595152$1397064638$gmane$org@versatic.net> (raw)
In-Reply-To: <953381139.1247.1397057797666.JavaMail.zimbra@efficios.com>

On 04/09/2014 11:36 AM, Mathieu Desnoyers wrote:
> ----- Original Message -----
>> From: "Geneviève Bastien" <gbastien+lttng@versatic.net>
>> To: lttng-dev@lists.lttng.org
>> Sent: Wednesday, March 26, 2014 10:47:08 AM
>> Subject: [lttng-dev] [RFC Patch Ust 1/5] Update data structures to support	CTF global structures
>>
>> The structures match those in LTTng-tools to support global structures.
>>
>> The struct lttng_structure contains the global types required by the
>> structure, but not ustctl_structure because global types will be flattened
>> in the event description when serializing.
>>
>> Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
>> ---
>>   include/lttng/ust-ctl.h    | 14 ++++++++++++++
>>   include/lttng/ust-events.h | 17 +++++++++++++++++
>>   2 files changed, 31 insertions(+)
>>
>> diff --git a/include/lttng/ust-ctl.h b/include/lttng/ust-ctl.h
>> index ba3a271..708501d 100644
>> --- a/include/lttng/ust-ctl.h
>> +++ b/include/lttng/ust-ctl.h
>> @@ -265,6 +265,7 @@ enum ustctl_abstract_types {
>>   	ustctl_atype_sequence,
>>   	ustctl_atype_string,
>>   	ustctl_atype_float,
>> +	ustctl_atype_structure,
>>   	NR_USTCTL_ABSTRACT_TYPES,
>>   };
>>   
>> @@ -335,6 +336,9 @@ struct ustctl_type {
>>   			struct ustctl_basic_type length_type;
>>   			struct ustctl_basic_type elem_type;
>>   		} sequence;
>> +		struct {
>> +			char name[LTTNG_UST_SYM_NAME_LEN];
>> +		} structure;
>>   		char padding[USTCTL_UST_TYPE_PADDING];
>>   	} u;
>>   } LTTNG_PACKED;
>> @@ -348,9 +352,18 @@ struct ustctl_enum {
>>   	char padding[USTCTL_UST_ENUM_TYPE_PADDING];
>>   } LTTNG_PACKED;
>>   
>> +#define USTCTL_UST_STRUCT_TYPE_PADDING	368
> why 368 bytes of padding ? What's so large that we could have to
> add to this structure ?
It's USTCTL_UST_GLOBAL_TYPE_DECL_PADDING (640) minus the size of the 
content of this structure. Could be smaller though if it is not always 
used inside the ustctl_global_type_decl. But it leaves enough space for 
at least another string if need be (but I don't know why we would need 
that for structures).
>
> Moreover, my other worry is the "const char *" we're adding for
> enums and structures. I'm concerned that when we eventually choose
> to dynamically allocate those (when we support dynamic probes), we
> will have to do ugly cast to remove the "const".
>
> Thoughts ?
No, I have no idea what to do with that piece of information... Sorry 
that's my limited knowledge of C. I've just seen const char * in many 
other places of the ust-events.h structures and did the same.

Thanks,
Geneviève
>
> Thanks,
>
> Mathieu
>
>> +struct ustctl_structure {
>> +	char name[LTTNG_UST_SYM_NAME_LEN];
>> +	size_t nr_fields;
>> +	struct ustctl_field *fields;
>> +	char padding[USTCTL_UST_STRUCT_TYPE_PADDING];
>> +};
>> +
>>   /* CTF categories for global types declared outside event descriptions */
>>   enum ustctl_global_type_categories {
>>   	ustctl_mtype_enum,
>> +	ustctl_mtype_structure,
>>   	NR_USTCTL_GLOBAL_TYPES,
>>   };
>>   
>> @@ -359,6 +372,7 @@ struct ustctl_global_type_decl {
>>   	uint32_t mtype;
>>   	union {
>>   		struct ustctl_enum ctf_enum;
>> +		struct ustctl_structure ctf_structure;
>>   		char padding[USTCTL_UST_GLOBAL_TYPE_DECL_PADDING];
>>   	} u;
>>   } LTTNG_PACKED;
>> diff --git a/include/lttng/ust-events.h b/include/lttng/ust-events.h
>> index 6f11e84..89155ae 100644
>> --- a/include/lttng/ust-events.h
>> +++ b/include/lttng/ust-events.h
>> @@ -82,6 +82,7 @@ enum lttng_abstract_types {
>>   	atype_sequence,
>>   	atype_string,
>>   	atype_float,
>> +	atype_structure,
>>   	NR_ABSTRACT_TYPES,
>>   };
>>   
>> @@ -96,6 +97,7 @@ enum lttng_string_encodings {
>>   /* CTF categories for global types declared outside event descriptions */
>>   enum lttng_global_type_categories {
>>   	mtype_enum,
>> +	mtype_structure,
>>   	NR_GLOBAL_TYPES,
>>   };
>>   
>> @@ -207,6 +209,9 @@ struct lttng_type {
>>   			struct lttng_basic_type length_type;
>>   			struct lttng_basic_type elem_type;
>>   		} sequence;
>> +		struct {
>> +			const char *name;
>> +		} structure;
>>   		char padding[LTTNG_UST_TYPE_PADDING];
>>   	} u;
>>   };
>> @@ -220,12 +225,24 @@ struct lttng_enum {
>>   	char padding[LTTNG_UST_ENUM_TYPE_PADDING];
>>   };
>>   
>> +#define LTTNG_UST_STRUCT_TYPE_PADDING 20
>> +struct lttng_structure {
>> +	const char *name;
>> +	size_t nr_fields;
>> +	const struct lttng_event_field *fields;
>> +	/* Global types required by this structure. */
>> +	unsigned int nr_global_type_decl;
>> +	const struct lttng_global_type_decl *global_type_decl;
>> +	char padding[LTTNG_UST_STRUCT_TYPE_PADDING];
>> +};
>> +
>>   #define LTTNG_UST_GLOBAL_TYPES_PADDING	60
>>   struct lttng_global_type_decl {
>>   	enum lttng_global_type_categories mtype;
>>   	unsigned int nowrite; /* inherited from the field using it */
>>   	union {
>>   		const struct lttng_enum *ctf_enum;
>> +		const struct lttng_structure *ctf_structure;
>>   		char padding[LTTNG_UST_GLOBAL_TYPES_PADDING];
>>   	} u;
>>   };
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> lttng-dev mailing list
>> lttng-dev@lists.lttng.org
>> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
>>


_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

  parent reply	other threads:[~2014-04-09 17:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1395845232-17669-1-git-send-email-gbastien+lttng@versatic.net>
2014-03-26 14:47 ` [RFC Patch Ust 1/5] Update data structures to support CTF global structures Geneviève Bastien
2014-03-26 14:47 ` [RFC Patch Ust 2/5] Serialize the CTF global structures for ust-comm Geneviève Bastien
2014-03-26 14:47 ` [RFC Patch Ust 3/5] Add the macros to generate the data structures for CTF global structures Geneviève Bastien
2014-03-26 14:47 ` [RFC Patch Ust 4/5] Update the ctf-global-type example to show the usage of a global structure Geneviève Bastien
2014-03-26 14:47 ` [RFC Patch Ust 5/5] Update the LTTng documentation with CTF global structures Geneviève Bastien
     [not found] ` <1395845232-17669-2-git-send-email-gbastien+lttng@versatic.net>
2014-04-09 15:36   ` [RFC Patch Ust 1/5] Update data structures to support " Mathieu Desnoyers
     [not found]   ` <953381139.1247.1397057797666.JavaMail.zimbra@efficios.com>
2014-04-09 17:29     ` Geneviève Bastien [this message]
     [not found]     ` <5345836A.1090509@versatic.net>
2014-04-27 11:24       ` Mathieu Desnoyers
     [not found] ` <1395845232-17669-3-git-send-email-gbastien+lttng@versatic.net>
2014-04-09 15:42   ` [RFC Patch Ust 2/5] Serialize the CTF global structures for ust-comm Mathieu Desnoyers
     [not found]   ` <224451157.1253.1397058138828.JavaMail.zimbra@efficios.com>
2014-04-09 17:33     ` Geneviève Bastien
     [not found]     ` <53458452.8030905@versatic.net>
2014-04-27  8:34       ` Mathieu Desnoyers
     [not found]       ` <2087397408.8083.1398587642565.JavaMail.zimbra@efficios.com>
2014-05-01  1:05         ` Geneviève Bastien
     [not found]         ` <53619DDF.5060909@versatic.net>
2014-05-02  9:29           ` 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='5345836A.1090509__15174.1926595152$1397064638$gmane$org@versatic.net' \
    --to=gbastien+lttng@versatic.net \
    --cc=lttng-dev@lists.lttng.org \
    --cc=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 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.