ctf: de-duplicate index entries
When trace snapshots were taken quickly enough, it's possible for them
to overlap. Some identical packets will be present in multiple
snapshots.
For example, the first snapshot could contain packets A, B and C while
the second snapshot could contain packets B, C, and D.
When reading those snapshots together with babeltrace, we will want to
present a coherent view of the logical trace that is spread across
multiple snapshots. That is, we will want to avoid reading the packet
twice.
Currently, we're not considering that case when building the building
the in-memory index. Processing the two streams above will lead to
those entries in the merged index:
- Packet A (snapshot 1)
- Packet B (snapshot 1)
- Packet B (snapshot 2)
- Packet C (snapshot 1)
- Packet C (snapshot 2)
- Packet D (snapshot 2)
This patch makes it so we only keep a single reference to each packet.
If a packet is duplicated, it doesn't matter to which snapshot the
reference points, since all copies of the packet are identical. So a
possible outcome of the situation above, with this patch applied, could
be:
- Packet A (snapshot 1)
- Packet B (snapshot 1)
- Packet C (snapshot 1)
- Packet D (snapshot 2)
So far the index is not used for much, so I don't think that this patch
will have any visible behavior change. However, an upcoming patch will
build on this to make it so we only read each packet once.
Change-Id: I00962d593b5078253043029902f853e5c3fa0dc5
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
This page took 0.025382 seconds and 4 git commands to generate.