assertTrue(cpr.hasMoreEvents());
EventDefinition event = cpr.readNextEvent();
assertEquals(0L, event.getTimestamp());
- assertEquals(event.getDeclaration().getName(), CTFStrings.LOST_EVENT_NAME);
- assertEquals(512L, ((IntegerDefinition) event.getFields().getDefinition(CTFStrings.LOST_EVENTS_FIELD)).getValue());
- assertTrue(cpr.hasMoreEvents());
- event = cpr.readNextEvent();
- assertEquals(0L, event.getTimestamp());
assertEquals(1L, ((IntegerDefinition) event.getFields().getDefinition("field")).getValue());
assertNotNull(cpr);
assertTrue(cpr.hasMoreEvents());
event = cpr.readNextEvent();
assertEquals(256L, event.getTimestamp());
assertEquals(0x5a, ((IntegerDefinition) event.getFields().getDefinition("field")).getValue());
+ assertTrue(cpr.hasMoreEvents());
+ event = cpr.readNextEvent();
+ assertEquals(256L, event.getTimestamp());
+ assertEquals(event.getDeclaration().getName(), CTFStrings.LOST_EVENT_NAME);
+ assertEquals(512L, ((IntegerDefinition) event.getFields().getDefinition(CTFStrings.LOST_EVENTS_FIELD)).getValue());
assertFalse(cpr.hasMoreEvents());
}
@Override
public boolean hasMoreEvents() {
- return fInput.position() < fPacketContext.getContentSizeBits();
+ return fHasLost || (fInput.position() < fPacketContext.getContentSizeBits());
}
@Override
* Return the Lost Event after all other events in this packet. We need
* to check if the bytebuffer is at the beginning too.
*/
- if (fHasLost && (posStart == fPacketContext.getPayloadStartBits())) {
+ if (fHasLost && (posStart >= fPacketContext.getContentSizeBits())) {
fHasLost = false;
return createLostEvent(fPacketContext);
}
*/
@Test
public void testFirstLostEvent() {
- final long rank = 152;
- final long startTime = 1376592664828848222L;
+ final long rank = 190;
+ final long startTime = 1376592664828900165L;
final ITmfTimestamp start = new TmfNanoTimestamp(startTime);
- final ITmfTimestamp end = new TmfNanoTimestamp(startTime + 554854L);
+ final ITmfTimestamp end = new TmfNanoTimestamp(startTime + 502911L);
final long nbLost = 859;
validateLostEvent(rank, start, end, nbLost);
*/
@Test
public void testSecondLostEvent() {
- final long rank = 191;
- final long startTime = 1376592664829402521L;
+ final long rank = 229;
+ final long startTime = 1376592664829477058L;
final ITmfTimestamp start = new TmfNanoTimestamp(startTime);
- final ITmfTimestamp end = new TmfNanoTimestamp(startTime + 421993L);
+ final ITmfTimestamp end = new TmfNanoTimestamp(startTime + 347456L);
final long nbLost = 488;
validateLostEvent(rank, start, end, nbLost);
*/
@Test
public void testNormalEvent() {
- final long rank = 193;
- final ITmfTimestamp ts = new TmfNanoTimestamp(1376592664829411423L);
+ final long rank = 200;
+ final ITmfTimestamp ts = new TmfNanoTimestamp(1376592664829425780L);
final CtfTmfEvent event = getOneEventTime(ts);
/* Make sure seeking by rank yields the same event */
trace.setTimestampTransform(TimestampTransformFactory.createWithOffset(offset));
trace.indexTrace(true);
- final long rank = 152;
- final ITmfTimestamp start = new TmfNanoTimestamp(1376592664828848222L + offset);
- final ITmfTimestamp end = new TmfNanoTimestamp(1376592664828848222L + 554854L + offset);
+ final long rank = 190;
+ final ITmfTimestamp start = new TmfNanoTimestamp(1376592664828900165L + offset);
+ final ITmfTimestamp end = new TmfNanoTimestamp(1376592664828900165L + 502911L + offset);
final long nbLost = 859;
ITmfContext context = trace.seekEvent(rank);
public OneEventRequestPerTs(@NonNull ITmfTimestamp ts) {
super(CtfTmfEvent.class,
new TmfTimeRange(ts, ts),
- 0, 1, ExecutionType.FOREGROUND);
+ 0, ITmfEventRequest.ALL_DATA, ExecutionType.FOREGROUND);
}
@Override