X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.ctf.core%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Fctf%2Fcore%2Ftrace%2FStreamInputPacketReader.java;h=50193e553cec1b02f50044347781a152e77d3ba4;hb=bfe038ff8f9d89aca42082b6973c7a91a420b743;hp=debc33527727b46f5c66ceec123c00ab45db7156;hpb=2b7f6f099213b3e7465fd6769bdb0039443d9c17;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketReader.java b/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketReader.java index debc335277..50193e553c 100644 --- a/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketReader.java +++ b/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/StreamInputPacketReader.java @@ -35,7 +35,7 @@ import org.eclipse.linuxtools.internal.ctf.core.trace.StreamInputPacketIndexEntr *
* Reads the events of a packet of a trace file. */ -class StreamInputPacketReader implements IDefinitionScope { +public class StreamInputPacketReader implements IDefinitionScope { // ------------------------------------------------------------------------ // Constants @@ -94,6 +94,13 @@ class StreamInputPacketReader implements IDefinitionScope { */ private int currentCpu = 0; + /** + * number of lost events in this packet + */ + private int lostEvents; + + private int lostSoFar; + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ @@ -116,6 +123,9 @@ class StreamInputPacketReader implements IDefinitionScope { * Create definitions needed to read the events. */ createDefinitions(); + + lostEvents = 0 ; + lostSoFar = 0 ; } // ------------------------------------------------------------------------ @@ -250,10 +260,22 @@ class StreamInputPacketReader implements IDefinitionScope { */ if (getStreamPacketContextDef() != null) { getStreamPacketContextDef().read(getBitBuffer()); + /* + * Read CPU ID + */ + Definition cpuiddef = getStreamPacketContextDef().lookupDefinition("cpu_id"); //$NON-NLS-1$ if (cpuiddef instanceof IntegerDefinition) { currentCpu = (int) ((IntegerDefinition) cpuiddef).getValue(); } + /* + * Read number of lost events + */ + Definition lostEventsdef = getStreamPacketContextDef().lookupDefinition("events_discarded"); //$NON-NLS-1$ + if (cpuiddef instanceof IntegerDefinition) { + lostEvents = (int) ((IntegerDefinition) lostEventsdef).getValue(); + } + } /* @@ -292,6 +314,14 @@ class StreamInputPacketReader implements IDefinitionScope { Long eventID = null; long timestamp = 0; + + if( lostEvents > lostSoFar) + { + EventDefinition eventDef = EventDeclaration.getLostEventDeclaration().createDefinition(streamInputReader); + eventDef.setTimestamp(this.lastTimestamp); + ++lostSoFar; + return eventDef; + } StructDefinition sehd = getStreamEventHeaderDef(); // acronym for a long variable name BitBuffer currentBitBuffer = getBitBuffer(); /* @@ -360,22 +390,22 @@ class StreamInputPacketReader implements IDefinitionScope { /* * Read the event context. */ - if (eventDef.context != null) { - eventDef.context.read(currentBitBuffer); + if (eventDef.getContext() != null) { + eventDef.getContext().read(currentBitBuffer); } /* * Read the event fields. */ - if (eventDef.fields != null) { - eventDef.fields.read(currentBitBuffer); + if (eventDef.getFields() != null) { + eventDef.getFields().read(currentBitBuffer); } /* * Set the event timestamp using the timestamp calculated by * updateTimestamp. */ - eventDef.timestamp = timestamp; + eventDef.setTimestamp(timestamp); return eventDef; }