use of org.eclipse.tracecompass.tmf.core.request.TmfEventRequest in project tracecompass by tracecompass.
the class UstDebugInfoAnalysisModuleTest method testBinaryCallsites.
/**
* Test that the binary callsite aspect resolves correctly for some
* user-defined tracepoints in the trace.
*
* These should be available even without the binaries with debug symbols
* being present on the system.
*/
@Test
public void testBinaryCallsites() {
LttngUstTrace trace = LttngUstTestTraceUtils.getTrace(REAL_TEST_TRACE);
/*
* Fake a "trace opened" signal, so that the relevant analyses are
* started.
*/
TmfTraceOpenedSignal signal = new TmfTraceOpenedSignal(this, trace, null);
TmfSignalManager.dispatchSignal(signal);
UstDebugInfoAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, UstDebugInfoAnalysisModule.class, UstDebugInfoAnalysisModule.ID);
assertNotNull(module);
module.waitForCompletion();
/* Send a request to get the 3 events we are interested in */
List<@NonNull LttngUstEvent> events = new ArrayList<>();
TmfEventRequest request = new TmfEventRequest(LttngUstEvent.class, 31, 1, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
events.add((LttngUstEvent) event);
}
};
trace.sendRequest(request);
try {
request.waitForCompletion();
} catch (InterruptedException e) {
fail(e.getMessage());
}
/* Tests that the aspects are resolved correctly */
final UstDebugInfoBinaryAspect aspect = UstDebugInfoBinaryAspect.INSTANCE;
String actual = checkNotNull(aspect.resolve(events.get(0))).toString();
String expected = "/home/simark/src/babeltrace/tests/debug-info-data/libhello_so+0x14d4";
assertEquals(expected, actual);
LttngUstTestTraceUtils.dispose(REAL_TEST_TRACE);
}
use of org.eclipse.tracecompass.tmf.core.request.TmfEventRequest in project tracecompass by tracecompass.
the class TmfCoalescedEventRequestTest method testFail.
// ------------------------------------------------------------------------
// fail
// ------------------------------------------------------------------------
@Test
public void testFail() {
final boolean[] crFlags = new boolean[4];
TmfCoalescedEventRequest request = setupTestRequest(crFlags);
TmfEventRequest subRequest1 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200);
TmfEventRequest subRequest2 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200);
request.addRequest(subRequest1);
request.addRequest(subRequest2);
request.fail(new IllformedLocaleException("Hi"));
// Validate the coalescing request
assertTrue("isCompleted", request.isCompleted());
assertTrue("isFailed", request.isFailed());
final Throwable failCause = request.getFailureCause();
assertNotNull("Cause of failure", failCause);
assertEquals("Cause of failure message", "Hi", failCause.getMessage());
assertFalse("isCancelled", request.isCancelled());
assertTrue("handleCompleted", crFlags[0]);
assertFalse("handleSuccess", crFlags[1]);
assertTrue("handleFailure", crFlags[2]);
assertFalse("handleCancel", crFlags[3]);
// Validate the first coalesced request
assertTrue("isCompleted", subRequest1.isCompleted());
assertTrue("isFailed", subRequest1.isFailed());
assertFalse("isCancelled", subRequest1.isCancelled());
// Validate the second coalesced request
assertTrue("isCompleted", subRequest2.isCompleted());
assertTrue("isFailed", subRequest2.isFailed());
assertFalse("isCancelled", subRequest2.isCancelled());
}
use of org.eclipse.tracecompass.tmf.core.request.TmfEventRequest in project tracecompass by tracecompass.
the class TmfCoalescedEventRequestTest method testDone.
// ------------------------------------------------------------------------
// done
// ------------------------------------------------------------------------
@Test
public void testDone() {
// Test request
final boolean[] crFlags = new boolean[4];
TmfCoalescedEventRequest request = setupTestRequest(crFlags);
TmfEventRequest subRequest1 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200);
TmfEventRequest subRequest2 = new TmfEventRequestStub(ITmfEvent.class, range1, 100, 200);
request.addRequest(subRequest1);
request.addRequest(subRequest2);
request.done();
// Validate the coalescing request
assertTrue("isCompleted", request.isCompleted());
assertFalse("isFailed", request.isFailed());
assertFalse("isCancelled", request.isCancelled());
assertTrue("handleCompleted", crFlags[0]);
assertTrue("handleSuccess", crFlags[1]);
assertFalse("handleFailure", crFlags[2]);
assertFalse("handleCancel", crFlags[3]);
// Validate the first coalesced request
assertTrue("isCompleted", subRequest1.isCompleted());
assertFalse("isFailed", subRequest1.isFailed());
assertFalse("isCancelled", subRequest1.isCancelled());
// Validate the second coalesced request
assertTrue("isCompleted", subRequest2.isCompleted());
assertFalse("isFailed", subRequest2.isFailed());
assertFalse("isCancelled", subRequest2.isCancelled());
}
use of org.eclipse.tracecompass.tmf.core.request.TmfEventRequest in project tracecompass by tracecompass.
the class TmfCoalescedEventRequestTest method trigger.
/**
* @param signal
* the trigger signal
*/
@TmfSignalHandler
public void trigger(final TmfTestTriggerSignal2 signal) {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.create(100, -3), TmfTimestamp.BIG_CRUNCH);
requestedEvents1 = new Vector<>();
request1 = new TmfEventRequest(ITmfEvent.class, range, 0, 1, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
if (!isCompleted()) {
requestedEvents1.add(event);
}
}
};
providers = TmfProviderManager.getProviders(ITmfEvent.class, TmfTraceStub.class);
providers[0].sendRequest(request1);
}
use of org.eclipse.tracecompass.tmf.core.request.TmfEventRequest in project tracecompass by tracecompass.
the class TmfCoalescedEventRequestTest method testAddEvent1.
// ------------------------------------------------------------------------
// addEvent
// ------------------------------------------------------------------------
@Test
public void testAddEvent1() {
TmfCoalescedEventRequest coalescedRequest = new TmfCoalescedEventRequest(ITmfEvent.class, range1, 0, 2147483647, ExecutionType.FOREGROUND, 0);
TmfEventRequest req1 = new TmfEventRequestStub(ITmfEvent.class, range1, 0, 2147483647, 200);
TmfEventRequest req2 = new TmfEventRequestStub(ITmfEvent.class, range1, 1, 2147483647, 200);
assertTrue("isCompatible", coalescedRequest.isCompatible(req1));
assertTrue("isCompatible", coalescedRequest.isCompatible(req2));
coalescedRequest.addRequest(req1);
coalescedRequest.addRequest(req2);
assertEquals("addRequest", 0, coalescedRequest.getIndex());
assertEquals("addRequest", 2147483647, coalescedRequest.getNbRequested());
}
Aggregations