[lttng-dev] Iterate events in one packet

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Feb 27 07:23:47 EST 2013


* Yao Qi (yao at codesourcery.com) wrote:
> Hi,
> When I generate CTF, I logically group events and put them into one  
> packet.  When reading the CTF data (w/ libbabeltrace), can I iterate  
> over events in one packet (and stop when iterator goes to the next 
> packet)?

I'm curious to see what you are trying to achieve by grouping events
this way ?

You know you could simply put each logical event group into a different
"channel" within the same trace, right ?

The level of abstraction at which the babeltrace iterator presents the
trace does not expose details about packet switching. I'd need more
information to understand the value of your use-case.

Thanks,

Mathieu

>
> For example,
>
> stream {
>         packet.context := struct {
>                 uint32_t content_size;
>                 uint32_t packet_size;
>         };
>         event.header := struct {
>                 uint32_t id;
>         };
> };
>
> event {
>         name = "tsv";
>         id = 1;
>         fields := struct {
>                 uint64_t val;
>                 uint32_t num;
>         };
> };
>
> event {
>         name = "register";
>         id = 0;
>         fields := struct {
>                 uint8_t contents[440];
>         };
> };
>
> we have multiple events and put them into different packets according to  
> my logic,
>
> packet 1: tsv1, register1,
> packet 2: tsv2, tsv3, register2
>
> from iterator's point of view, packet boundary is invisible and iterator  
> will go through them like "tsv1, register1, tsv2, tsv3, register2".  In  
> order to identify the boundary of packet in the iterator, I have to  
> create a event "marker" and put it at the first event of one packet.
>
> event {
>         name = "marker";
>         id = 2;
>         fields := struct {
>         };
> };
>
> packet 1: marker1, tsv1, register1,
> packet 2: marker2, tsv2, tsv3, register2
>
> We'll stop the iteration once we see "marker" event.  It works for me,  
> but I am wondering we can solve this problem in a better way?
>
> -- 
> Yao (齐尧)
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list