use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class BtfTraceTest method testRead10thEvent2.
/**
* Read the tenth event without seeking
*/
@Test
public void testRead10thEvent2() {
ITmfContext ctx = fixture.seekEvent(0);
ITmfEvent event = fixture.getNext(ctx);
for (int i = 0; i < EVENT_RANK_10; i++) {
event = fixture.getNext(ctx);
}
assertNotNull(event);
validateCommentEvent(ECXPECT_CONTENT_EVENT_10, event);
}
use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class BtfTraceTest method testRead10thEvent1.
/**
* Read the tenth event
*/
@Test
public void testRead10thEvent1() {
ITmfContext ctx = fixture.seekEvent(EVENT_RANK_10);
ITmfEvent event = fixture.getNext(ctx);
assertNotNull(event);
validateCommentEvent(ECXPECT_CONTENT_EVENT_10, event);
}
use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class BtfTraceTest method testReadCommentLineEvent1.
/**
* Read the event after comment line
*/
@Test
public void testReadCommentLineEvent1() {
ITmfContext ctx = fixture.seekEvent(EVENT_RANK_COMMENT_TEST);
ITmfEvent event = fixture.getNext(ctx);
assertNotNull(event);
validateCommentEvent(ECXPECT_CONTENT_COMMENT_EVENT, event);
}
use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class BtfTraceTest method testTwoContexts.
/**
* Read two contexts
*/
@Test
public void testTwoContexts() {
ITmfContext ctx0 = fixture.seekEvent(0);
ITmfContext ctx1 = fixture.seekEvent(10);
ITmfEvent event = null;
for (int i = 0; i < 11; i++) {
event = fixture.getNext(ctx0);
}
ITmfEvent event1 = fixture.getNext(ctx1);
assertNotNull(event);
assertNotNull(event1);
assertEquals(event, event1);
}
use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class StreamListAnalysis method executeAnalysis.
@Override
protected boolean executeAnalysis(@Nullable IProgressMonitor monitor) throws TmfAnalysisException {
IProgressMonitor mon = (monitor == null ? new NullProgressMonitor() : monitor);
ITmfTrace trace = getTrace();
if (trace == null) {
/* This analysis was cancelled in the meantime */
return false;
}
ITmfEventRequest request = fRequest;
if ((request != null) && (!request.isCompleted())) {
request.cancel();
}
request = new TmfEventRequest(PcapEvent.class, TmfTimeRange.ETERNITY, 0L, ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.BACKGROUND) {
@Override
public void handleData(ITmfEvent data) {
// Called for each event
super.handleData(data);
if (!(data instanceof PcapEvent)) {
return;
}
PcapEvent event = (PcapEvent) data;
for (Map.Entry<TmfPcapProtocol, TmfPacketStreamBuilder> entry : fBuilders.entrySet()) {
entry.getValue().addEventToStream(event);
}
}
};
trace.sendRequest(request);
fRequest = request;
try {
request.waitForCompletion();
} catch (InterruptedException e) {
// Request was canceled.
return false;
}
return !mon.isCanceled() && !request.isCancelled() && !request.isFailed();
}
Aggregations