Skip to contentSkip to conversation

Iterate events in one packet

DISCUSSION Yao Qi 1 participant 1 message Feb 27, 2013

lore
Share & tools
lore

Yao Qi

author
#0 lore raw

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)?

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?

Signature · 6 lines
Yao (齐尧)

_______________________________________________
lttng-dev mailing list
[email protected]
http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev