Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [ltt-dev] Traces data alignment
@ 2009-03-19 15:06 Jérôme Stadelmann
  2009-03-19 17:00 ` Mathieu Desnoyers
  0 siblings, 1 reply; 10+ messages in thread
From: Jérôme Stadelmann @ 2009-03-19 15:06 UTC (permalink / raw)


Hi everybody,

I'm working on a LTTng traces parser and I'm a little bit blocked on the alignment. Can someone please explain how and where it is coded ?
What are the roles of the alignment defined in the traces header and the one defined in the metadata file in the core_marker_id ?

Regards,
Jerome




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ltt-dev] Traces data alignment
  2009-03-19 15:06 [ltt-dev] Traces data alignment Jérôme Stadelmann
@ 2009-03-19 17:00 ` Mathieu Desnoyers
  2009-03-20  7:16   ` Jérôme Stadelmann
  0 siblings, 1 reply; 10+ messages in thread
From: Mathieu Desnoyers @ 2009-03-19 17:00 UTC (permalink / raw)


* J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> Hi everybody,
> 
> I'm working on a LTTng traces parser and I'm a little bit blocked on the alignment. Can someone please explain how and where it is coded ?

The lttv lib "ltttraceread" should do that for you.

> What are the roles of the alignment defined in the traces header and the one defined in the metadata file in the core_marker_id ?
> 

They tell that a specific tracefile content is aligned or not, and if
the content of a given event is aligned or not. You should really have
at least a look at the ltt lib traceread reference implementation.

Mathieu

> Regards,
> Jerome
> 
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ltt-dev] Traces data alignment
  2009-03-19 17:00 ` Mathieu Desnoyers
@ 2009-03-20  7:16   ` Jérôme Stadelmann
  2009-03-20 14:53     ` Mathieu Desnoyers
  0 siblings, 1 reply; 10+ messages in thread
From: Jérôme Stadelmann @ 2009-03-20  7:16 UTC (permalink / raw)


On jeudi 19 mars 2009 18:00:01 Mathieu Desnoyers wrote:
> * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > Hi everybody,
> > 
> > I'm working on a LTTng traces parser and I'm a little bit blocked on the alignment. Can someone please explain how and where it is coded ?
> 
> The lttv lib "ltttraceread" should do that for you.
 
> > What are the roles of the alignment defined in the traces header and the one defined in the metadata file in the core_marker_id ?
> > 
> 
> They tell that a specific tracefile content is aligned or not, and if
> the content of a given event is aligned or not. You should really have
> at least a look at the ltt lib traceread reference implementation.

Thank you. This library helped me a lot. I see that there is an up to 2 byte alignment in the core marker id event definition. Is there the only special case ?
I've searched the uses of the ltt_align function. Are there other functions to look for ?

Jerome
 
> Mathieu
> 
> > Regards,
> > Jerome
> > 
> > _______________________________________________
> > ltt-dev mailing list
> > ltt-dev at lists.casi.polymtl.ca
> > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> > 
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ltt-dev] Traces data alignment
  2009-03-20  7:16   ` Jérôme Stadelmann
@ 2009-03-20 14:53     ` Mathieu Desnoyers
  2009-03-23  7:03       ` Jérôme Stadelmann
  2009-03-24  8:34       ` Jérôme Stadelmann
  0 siblings, 2 replies; 10+ messages in thread
From: Mathieu Desnoyers @ 2009-03-20 14:53 UTC (permalink / raw)


* J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> On jeudi 19 mars 2009 18:00:01 Mathieu Desnoyers wrote:
> > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > Hi everybody,
> > > 
> > > I'm working on a LTTng traces parser and I'm a little bit blocked on the alignment. Can someone please explain how and where it is coded ?
> > 
> > The lttv lib "ltttraceread" should do that for you.
>  
> > > What are the roles of the alignment defined in the traces header and the one defined in the metadata file in the core_marker_id ?
> > > 
> > 
> > They tell that a specific tracefile content is aligned or not, and if
> > the content of a given event is aligned or not. You should really have
> > at least a look at the ltt lib traceread reference implementation.
> 
> Thank you. This library helped me a lot. I see that there is an up to 2 byte alignment in the core marker id event definition. Is there the only special case ?
> I've searched the uses of the ltt_align function. Are there other functions to look for ?
> 

Looking at ltt_align use is a good starting point.

Can you point out to the specific package/version/file/line you refer to
for the core marker id "special case" you talk about here ?

Mathieu

> Jerome
>  
> > Mathieu
> > 
> > > Regards,
> > > Jerome
> > > 
> > > _______________________________________________
> > > ltt-dev mailing list
> > > ltt-dev at lists.casi.polymtl.ca
> > > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> > > 
> > 
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ltt-dev] Traces data alignment
  2009-03-20 14:53     ` Mathieu Desnoyers
@ 2009-03-23  7:03       ` Jérôme Stadelmann
  2009-03-24  8:34       ` Jérôme Stadelmann
  1 sibling, 0 replies; 10+ messages in thread
From: Jérôme Stadelmann @ 2009-03-23  7:03 UTC (permalink / raw)


On vendredi 20 mars 2009 15:53:55 Mathieu Desnoyers wrote:
> * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > On jeudi 19 mars 2009 18:00:01 Mathieu Desnoyers wrote:
> > > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > > Hi everybody,
> > > > 
> > > > I'm working on a LTTng traces parser and I'm a little bit blocked on the alignment. Can someone please explain how and where it is coded ?
> > > 
> > > The lttv lib "ltttraceread" should do that for you.
> >  
> > > > What are the roles of the alignment defined in the traces header and the one defined in the metadata file in the core_marker_id ?
> > > > 
> > > 
> > > They tell that a specific tracefile content is aligned or not, and if
> > > the content of a given event is aligned or not. You should really have
> > > at least a look at the ltt lib traceread reference implementation.
> > 
> > Thank you. This library helped me a lot. I see that there is an up to 2 byte alignment in the core marker id event definition. Is there the only special case ?
> > I've searched the uses of the ltt_align function. Are there other functions to look for ?
> > 
> 
> Looking at ltt_align use is a good starting point.
> 
> Can you point out to the specific package/version/file/line you refer to
> for the core marker id "special case" you talk about here ?
> 

I'm using the version lttv-0.12.4-18122008 with the Lttng 0.82

in file tracefile.c
function ltt_update_event_size
line 1506 :   size += ltt_align(size, sizeof(guint16), tf->alignment);

I don't understand why an alignment of 2 bytes here.

Jerome

> Mathieu
> 
> > Jerome
> >  
> > > Mathieu
> > > 
> > > > Regards,
> > > > Jerome
> > > > 
> > > > _______________________________________________
> > > > ltt-dev mailing list
> > > > ltt-dev at lists.casi.polymtl.ca
> > > > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> > > > 
> > > 
> > 
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ltt-dev] Traces data alignment
  2009-03-20 14:53     ` Mathieu Desnoyers
  2009-03-23  7:03       ` Jérôme Stadelmann
@ 2009-03-24  8:34       ` Jérôme Stadelmann
  2009-03-24 13:11         ` Mathieu Desnoyers
  1 sibling, 1 reply; 10+ messages in thread
From: Jérôme Stadelmann @ 2009-03-24  8:34 UTC (permalink / raw)


On vendredi 20 mars 2009 15:53:55 Mathieu Desnoyers wrote:
> * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > On jeudi 19 mars 2009 18:00:01 Mathieu Desnoyers wrote:
> > > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > > Hi everybody,
> > > > 
> > > > I'm working on a LTTng traces parser and I'm a little bit blocked on the alignment. Can someone please explain how and where it is coded ?
> > > 
> > > The lttv lib "ltttraceread" should do that for you.
> >  
> > > > What are the roles of the alignment defined in the traces header and the one defined in the metadata file in the core_marker_id ?
> > > > 
> > > 
> > > They tell that a specific tracefile content is aligned or not, and if
> > > the content of a given event is aligned or not. You should really have
> > > at least a look at the ltt lib traceread reference implementation.
> > 
> > Thank you. This library helped me a lot. I see that there is an up to 2 byte alignment in the core marker id event definition. Is there the only special case ?
> > I've searched the uses of the ltt_align function. Are there other functions to look for ?
> > 
> 
> Looking at ltt_align use is a good starting point.
> 
> Can you point out to the specific package/version/file/line you refer to
> for the core marker id "special case" you talk about here ?
> 

I think I've understood now. The alignment in the metadata file is "hardcoded" as 2 byte because the id field is the biggest value and is coded as a 2 bytes value. Am I right ?

> Mathieu
> 
> > Jerome
> >  
> > > Mathieu
> > > 
> > > > Regards,
> > > > Jerome
> > > > 
> > > > _______________________________________________
> > > > ltt-dev mailing list
> > > > ltt-dev at lists.casi.polymtl.ca
> > > > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> > > > 
> > > 
> > 
> 




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ltt-dev] Traces data alignment
  2009-03-24  8:34       ` Jérôme Stadelmann
@ 2009-03-24 13:11         ` Mathieu Desnoyers
  2009-03-25  6:16           ` Jérôme Stadelmann
  0 siblings, 1 reply; 10+ messages in thread
From: Mathieu Desnoyers @ 2009-03-24 13:11 UTC (permalink / raw)


* J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> On vendredi 20 mars 2009 15:53:55 Mathieu Desnoyers wrote:
> > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > On jeudi 19 mars 2009 18:00:01 Mathieu Desnoyers wrote:
> > > > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > > > Hi everybody,
> > > > > 
> > > > > I'm working on a LTTng traces parser and I'm a little bit blocked on the alignment. Can someone please explain how and where it is coded ?
> > > > 
> > > > The lttv lib "ltttraceread" should do that for you.
> > >  
> > > > > What are the roles of the alignment defined in the traces header and the one defined in the metadata file in the core_marker_id ?
> > > > > 
> > > > 
> > > > They tell that a specific tracefile content is aligned or not, and if
> > > > the content of a given event is aligned or not. You should really have
> > > > at least a look at the ltt lib traceread reference implementation.
> > > 
> > > Thank you. This library helped me a lot. I see that there is an up to 2 byte alignment in the core marker id event definition. Is there the only special case ?
> > > I've searched the uses of the ltt_align function. Are there other functions to look for ?
> > > 
> > 
> > Looking at ltt_align use is a good starting point.
> > 
> > Can you point out to the specific package/version/file/line you refer to
> > for the core marker id "special case" you talk about here ?
> > 
> 
> I think I've understood now. The alignment in the metadata file is
> "hardcoded" as 2 byte because the id field is the biggest value and is
> coded as a 2 bytes value. Am I right ?
> 

Possibly. Again, can you point out which package/version/file/line you
refer to so I can be sure we are talking about the same piece of code ?
Telling which file and function, with a cut and paste of the context,
would be nice to have.

Mathieu

> > Mathieu
> > 
> > > Jerome
> > >  
> > > > Mathieu
> > > > 
> > > > > Regards,
> > > > > Jerome
> > > > > 
> > > > > _______________________________________________
> > > > > ltt-dev mailing list
> > > > > ltt-dev at lists.casi.polymtl.ca
> > > > > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> > > > > 
> > > > 
> > > 
> > 
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ltt-dev] Traces data alignment
  2009-03-24 13:11         ` Mathieu Desnoyers
@ 2009-03-25  6:16           ` Jérôme Stadelmann
  2009-03-25  7:05             ` Mathieu Desnoyers
  0 siblings, 1 reply; 10+ messages in thread
From: Jérôme Stadelmann @ 2009-03-25  6:16 UTC (permalink / raw)


On mardi 24 mars 2009 14:11:31 Mathieu Desnoyers wrote:
> * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > On vendredi 20 mars 2009 15:53:55 Mathieu Desnoyers wrote:
> > > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > > On jeudi 19 mars 2009 18:00:01 Mathieu Desnoyers wrote:
> > > > > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > > > > Hi everybody,
> > > > > > 
> > > > > > I'm working on a LTTng traces parser and I'm a little bit blocked on the alignment. Can someone please explain how and where it is coded ?
> > > > > 
> > > > > The lttv lib "ltttraceread" should do that for you.
> > > >  
> > > > > > What are the roles of the alignment defined in the traces header and the one defined in the metadata file in the core_marker_id ?
> > > > > > 
> > > > > 
> > > > > They tell that a specific tracefile content is aligned or not, and if
> > > > > the content of a given event is aligned or not. You should really have
> > > > > at least a look at the ltt lib traceread reference implementation.
> > > > 
> > > > Thank you. This library helped me a lot. I see that there is an up to 2 byte alignment in the core marker id event definition. Is there the only special case ?
> > > > I've searched the uses of the ltt_align function. Are there other functions to look for ?
> > > > 
> > > 
> > > Looking at ltt_align use is a good starting point.
> > > 
> > > Can you point out to the specific package/version/file/line you refer to
> > > for the core marker id "special case" you talk about here ?
> > > 
> > 
> > I think I've understood now. The alignment in the metadata file is
> > "hardcoded" as 2 byte because the id field is the biggest value and is
> > coded as a 2 bytes value. Am I right ?
> > 
> 
> Possibly. Again, can you point out which package/version/file/line you
> refer to so I can be sure we are talking about the same piece of code ?
> Telling which file and function, with a cut and paste of the context,
> would be nice to have.
> 

in tracefile.c :

static int ltt_process_metadata_tracefile(LttTracefile *tf)
{
	.....

        case MARKER_ID_SET_MARKER_ID:
          channel_name = pos = tf->event.data;
	  pos += strlen(channel_name) + 1;
	  marker_name = pos;
          g_debug("Doing MARKER_ID_SET_MARKER_ID of marker %s.%s",
	    channel_name, marker_name);
          pos += strlen(marker_name) + 1;

          pos += ltt_align((size_t)pos, sizeof(guint16), tf->alignment);

          id = ltt_get_uint16(LTT_GET_BO(tf), pos);
          g_debug("In MARKER_ID_SET_MARKER_ID of marker %s.%s id %hu",
	  	channel_name, marker_name, id);
          pos += sizeof(guint16);
          int_size = *(guint8*)pos;
          pos += sizeof(guint8);
          long_size = *(guint8*)pos;
          pos += sizeof(guint8);
          pointer_size = *(guint8*)pos;
          pos += sizeof(guint8);
          size_t_size = *(guint8*)pos;
          pos += sizeof(guint8);
          alignment = *(guint8*)pos;
          pos += sizeof(guint8);

	.....
}

As I said, you are using an "hardcoded" up to 2 bytes alignment because you already know in this case all the fields ?

> Mathieu
> 
> > > Mathieu
> > > 
> > > > Jerome
> > > >  
> > > > > Mathieu
> > > > > 
> > > > > > Regards,
> > > > > > Jerome
> > > > > > 
> > > > > > _______________________________________________
> > > > > > ltt-dev mailing list
> > > > > > ltt-dev at lists.casi.polymtl.ca
> > > > > > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ltt-dev] Traces data alignment
  2009-03-25  6:16           ` Jérôme Stadelmann
@ 2009-03-25  7:05             ` Mathieu Desnoyers
  2009-03-26  6:41               ` Jérôme Stadelmann
  0 siblings, 1 reply; 10+ messages in thread
From: Mathieu Desnoyers @ 2009-03-25  7:05 UTC (permalink / raw)


* J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> On mardi 24 mars 2009 14:11:31 Mathieu Desnoyers wrote:
> > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > On vendredi 20 mars 2009 15:53:55 Mathieu Desnoyers wrote:
> > > > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > > > On jeudi 19 mars 2009 18:00:01 Mathieu Desnoyers wrote:
> > > > > > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > > > > > Hi everybody,
> > > > > > > 
> > > > > > > I'm working on a LTTng traces parser and I'm a little bit blocked on the alignment. Can someone please explain how and where it is coded ?
> > > > > > 
> > > > > > The lttv lib "ltttraceread" should do that for you.
> > > > >  
> > > > > > > What are the roles of the alignment defined in the traces header and the one defined in the metadata file in the core_marker_id ?
> > > > > > > 
> > > > > > 
> > > > > > They tell that a specific tracefile content is aligned or not, and if
> > > > > > the content of a given event is aligned or not. You should really have
> > > > > > at least a look at the ltt lib traceread reference implementation.
> > > > > 
> > > > > Thank you. This library helped me a lot. I see that there is an up to 2 byte alignment in the core marker id event definition. Is there the only special case ?
> > > > > I've searched the uses of the ltt_align function. Are there other functions to look for ?
> > > > > 
> > > > 
> > > > Looking at ltt_align use is a good starting point.
> > > > 
> > > > Can you point out to the specific package/version/file/line you refer to
> > > > for the core marker id "special case" you talk about here ?
> > > > 
> > > 
> > > I think I've understood now. The alignment in the metadata file is
> > > "hardcoded" as 2 byte because the id field is the biggest value and is
> > > coded as a 2 bytes value. Am I right ?
> > > 
> > 
> > Possibly. Again, can you point out which package/version/file/line you
> > refer to so I can be sure we are talking about the same piece of code ?
> > Telling which file and function, with a cut and paste of the context,
> > would be nice to have.
> > 
> 
> in tracefile.c :
> 
> static int ltt_process_metadata_tracefile(LttTracefile *tf)
> {
> 	.....
> 
>         case MARKER_ID_SET_MARKER_ID:
>           channel_name = pos = tf->event.data;
> 	  pos += strlen(channel_name) + 1;
> 	  marker_name = pos;
>           g_debug("Doing MARKER_ID_SET_MARKER_ID of marker %s.%s",
> 	    channel_name, marker_name);
>           pos += strlen(marker_name) + 1;
> 
>           pos += ltt_align((size_t)pos, sizeof(guint16), tf->alignment);
> 
>           id = ltt_get_uint16(LTT_GET_BO(tf), pos);
>           g_debug("In MARKER_ID_SET_MARKER_ID of marker %s.%s id %hu",
> 	  	channel_name, marker_name, id);
>           pos += sizeof(guint16);
>           int_size = *(guint8*)pos;
>           pos += sizeof(guint8);
>           long_size = *(guint8*)pos;
>           pos += sizeof(guint8);
>           pointer_size = *(guint8*)pos;
>           pos += sizeof(guint8);
>           size_t_size = *(guint8*)pos;
>           pos += sizeof(guint8);
>           alignment = *(guint8*)pos;
>           pos += sizeof(guint8);
> 
> 	.....
> }
> 
> As I said, you are using an "hardcoded" up to 2 bytes alignment because you already know in this case all the fields ?
> 

I use a 2 bytes alignment there because I know the next field is 2
bytes in size.

Alignment of the whole event payload is done by the
ltt_update_event_size() call in ltt_tracefile_read_update_event(). See
the following comment :

  /*
   * Let ltt_update_event_size update event->data according to the largest
   * alignment within the payload.
   * Get the data size and update the event fields with the current
   * information. */

There is a small trick here though : ltt_update_event_size() seems to
assume that the payload will always be aligned on 2-bytes boundaries (it
does not ltt_align at the beginning of the metadata parsing code). It's
OK because, when trace alignment is active, event headers are aligned on
their own size, and they are always multiples of 2 bytes.

It could be more solid if I added a ltt_align on 2-bytes at the
beginning of those though. That would not fail if the event header
becomes something else than a 2-bytes multiple.

Mathieu

> > Mathieu
> > 
> > > > Mathieu
> > > > 
> > > > > Jerome
> > > > >  
> > > > > > Mathieu
> > > > > > 
> > > > > > > Regards,
> > > > > > > Jerome
> > > > > > > 
> > > > > > > _______________________________________________
> > > > > > > ltt-dev mailing list
> > > > > > > ltt-dev at lists.casi.polymtl.ca
> > > > > > > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68




^ permalink raw reply	[flat|nested] 10+ messages in thread

* [ltt-dev] Traces data alignment
  2009-03-25  7:05             ` Mathieu Desnoyers
@ 2009-03-26  6:41               ` Jérôme Stadelmann
  0 siblings, 0 replies; 10+ messages in thread
From: Jérôme Stadelmann @ 2009-03-26  6:41 UTC (permalink / raw)


On mercredi 25 mars 2009 08:05:18 Mathieu Desnoyers wrote:
> * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > On mardi 24 mars 2009 14:11:31 Mathieu Desnoyers wrote:
> > > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > > On vendredi 20 mars 2009 15:53:55 Mathieu Desnoyers wrote:
> > > > > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > > > > On jeudi 19 mars 2009 18:00:01 Mathieu Desnoyers wrote:
> > > > > > > * J?r?me Stadelmann (jerome.stadelmann at heig-vd.ch) wrote:
> > > > > > > > Hi everybody,
> > > > > > > > 
> > > > > > > > I'm working on a LTTng traces parser and I'm a little bit blocked on the alignment. Can someone please explain how and where it is coded ?
> > > > > > > 
> > > > > > > The lttv lib "ltttraceread" should do that for you.
> > > > > >  
> > > > > > > > What are the roles of the alignment defined in the traces header and the one defined in the metadata file in the core_marker_id ?
> > > > > > > > 
> > > > > > > 
> > > > > > > They tell that a specific tracefile content is aligned or not, and if
> > > > > > > the content of a given event is aligned or not. You should really have
> > > > > > > at least a look at the ltt lib traceread reference implementation.
> > > > > > 
> > > > > > Thank you. This library helped me a lot. I see that there is an up to 2 byte alignment in the core marker id event definition. Is there the only special case ?
> > > > > > I've searched the uses of the ltt_align function. Are there other functions to look for ?
> > > > > > 
> > > > > 
> > > > > Looking at ltt_align use is a good starting point.
> > > > > 
> > > > > Can you point out to the specific package/version/file/line you refer to
> > > > > for the core marker id "special case" you talk about here ?
> > > > > 
> > > > 
> > > > I think I've understood now. The alignment in the metadata file is
> > > > "hardcoded" as 2 byte because the id field is the biggest value and is
> > > > coded as a 2 bytes value. Am I right ?
> > > > 
> > > 
> > > Possibly. Again, can you point out which package/version/file/line you
> > > refer to so I can be sure we are talking about the same piece of code ?
> > > Telling which file and function, with a cut and paste of the context,
> > > would be nice to have.
> > > 
> > 
> > in tracefile.c :
> > 
> > static int ltt_process_metadata_tracefile(LttTracefile *tf)
> > {
> > 	.....
> > 
> >         case MARKER_ID_SET_MARKER_ID:
> >           channel_name = pos = tf->event.data;
> > 	  pos += strlen(channel_name) + 1;
> > 	  marker_name = pos;
> >           g_debug("Doing MARKER_ID_SET_MARKER_ID of marker %s.%s",
> > 	    channel_name, marker_name);
> >           pos += strlen(marker_name) + 1;
> > 
> >           pos += ltt_align((size_t)pos, sizeof(guint16), tf->alignment);
> > 
> >           id = ltt_get_uint16(LTT_GET_BO(tf), pos);
> >           g_debug("In MARKER_ID_SET_MARKER_ID of marker %s.%s id %hu",
> > 	  	channel_name, marker_name, id);
> >           pos += sizeof(guint16);
> >           int_size = *(guint8*)pos;
> >           pos += sizeof(guint8);
> >           long_size = *(guint8*)pos;
> >           pos += sizeof(guint8);
> >           pointer_size = *(guint8*)pos;
> >           pos += sizeof(guint8);
> >           size_t_size = *(guint8*)pos;
> >           pos += sizeof(guint8);
> >           alignment = *(guint8*)pos;
> >           pos += sizeof(guint8);
> > 
> > 	.....
> > }
> > 
> > As I said, you are using an "hardcoded" up to 2 bytes alignment because you already know in this case all the fields ?
> > 
> 
> I use a 2 bytes alignment there because I know the next field is 2
> bytes in size.
> 
> Alignment of the whole event payload is done by the
> ltt_update_event_size() call in ltt_tracefile_read_update_event(). See
> the following comment :
> 
>   /*
>    * Let ltt_update_event_size update event->data according to the largest
>    * alignment within the payload.
>    * Get the data size and update the event fields with the current
>    * information. */
> 
> There is a small trick here though : ltt_update_event_size() seems to
> assume that the payload will always be aligned on 2-bytes boundaries (it
> does not ltt_align at the beginning of the metadata parsing code). It's
> OK because, when trace alignment is active, event headers are aligned on
> their own size, and they are always multiples of 2 bytes.
> 
> It could be more solid if I added a ltt_align on 2-bytes at the
> beginning of those though. That would not fail if the event header
> becomes something else than a 2-bytes multiple.
> 
> Mathieu


Now with your explanations I could do what I wanted. Thanks for your help.

Best regards
Jerome

> 
> > > Mathieu
> > > 
> > > > > Mathieu
> > > > > 
> > > > > > Jerome
> > > > > >  
> > > > > > > Mathieu
> > > > > > > 
> > > > > > > > Regards,
> > > > > > > > Jerome
> > > > > > > > 
> > > > > > > > _______________________________________________
> > > > > > > > ltt-dev mailing list
> > > > > > > > ltt-dev at lists.casi.polymtl.ca
> > > > > > > > http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
> > > > > > > > 
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-03-26  6:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-19 15:06 [ltt-dev] Traces data alignment Jérôme Stadelmann
2009-03-19 17:00 ` Mathieu Desnoyers
2009-03-20  7:16   ` Jérôme Stadelmann
2009-03-20 14:53     ` Mathieu Desnoyers
2009-03-23  7:03       ` Jérôme Stadelmann
2009-03-24  8:34       ` Jérôme Stadelmann
2009-03-24 13:11         ` Mathieu Desnoyers
2009-03-25  6:16           ` Jérôme Stadelmann
2009-03-25  7:05             ` Mathieu Desnoyers
2009-03-26  6:41               ` Jérôme Stadelmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox