ctf: Introduce IPacketReader
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 27 Aug 2015 02:32:24 +0000 (22:32 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Fri, 20 Nov 2015 22:37:15 +0000 (17:37 -0500)
commit42f8feff1c760791ebc9224ca1625238d787bfac
treee1b2c828d26bdaed3f6e9bd005494859b1e7f1eb
parent9922fcdca647281de61292e17b442dcab62af384
ctf: Introduce IPacketReader

Introduce the IPacketReader api to allow better decoupling between the
streaminputreader and the packet reader. This allows for more packet
reader types in the future, such as an InMemoryPacketReader for streamed
in RAM traces.

The IPacketReader is currently implemented by 2 classes:
    * a NullPacketReader, if there is no data to read
    * a CTFPacketReader, the typical packet reader

The CTFPacketReader is quite different from the CTFStreamPacketReader. The
SPR holds on to a FileChannel and maps segments as it needs. This results in
a fast but complex sliding window like reader. On the other hand, the
CTFPacketReader will only read one packet of a stream, a new one needs to
be created for each packet. This makes it wrap a single BitBuffer. As
FileChannels are resources but Bit(Byte)Buffers are not, this means a
CTFPacketReader is NOT autoclosable.

It should be noted that ByteBuffers can hold onto a system file handle. They
are released on GC. Also, ByteBuffers as they have their handle, will not
require the fileChannel to be opened all the time, so resources can be
dynamically closed when running low on file handles.

This patch also fixes some bugs in the tests relating to uninitialized traces
and lost event locations that were hidden due to "event.equals" not working as
well as it should.

The reason this patch does two things at the same time is that the interface
required a major re-write of the packet reader. This resulted in several bugs
being highlighted and fixed. To fix them in a separate patch before would
be very time consuming, and fixing them after would mean deliberately writing
a buggy packet reader to fix it in a subsequent patch.

This change will allow the following changes down the road:
    * In memory ctf reading (network streams)
    * Encrypted ctf stream reading
    * Compressed ctf stream reading
    * Multi-threaded stream reading
    * A power set of the previous elements

Change-Id: Id45b69bb0dac7a1f74f50cd732cd92064595f737
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/53284
Reviewed-by: Hudson CI
18 files changed:
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/EventDefinition.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStream.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInput.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputPacketReader.java [deleted file]
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFStreamInputReader.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTrace.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/CTFTraceReader.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/ICTFPacketDescriptor.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/trace/IPacketReader.java [new file with mode: 0644]
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/event/EventDeclaration.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/CTFPacketReader.java [new file with mode: 0644]
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/NullPacketReader.java [new file with mode: 0644]
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/StreamInputPacketIndexEntry.java
ctf/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/internal/ctf/core/trace/StreamInputReaderTimestampComparator.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/CtfTmfEventTest.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/CtfTmfLostEventStatisticsTest.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/event/CtfTmfLostEventsTest.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/viewers/piecharts/TmfPieChartViewer.java
This page took 0.026528 seconds and 5 git commands to generate.