use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent in project tracecompass by tracecompass.
the class UstKernelSyncTest method testOneEvent.
/**
* Test that the TID given by the kernel analysis matches the one from the
* UST event's context for a given UST event that was known to fail.
*
* Reproduces the specific example that was pointed out in bug 484620.
*/
@Test
public void testOneEvent() {
TmfExperiment experiment = fExperiment;
ITmfTrace ustTrace = fUstTrace;
KernelAnalysisModule module = fKernelModule;
assertNotNull(experiment);
assertNotNull(ustTrace);
assertNotNull(module);
Predicate<@NonNull ITmfEvent> eventFinder = event -> {
Long addr = event.getContent().getFieldValue(Long.class, "addr");
Long cs = event.getContent().getFieldValue(Long.class, "call_site");
Long ctxVtid = event.getContent().getFieldValue(Long.class, "context._vtid");
if (addr == null || cs == null || ctxVtid == null) {
return false;
}
return Objects.equals(event.getType().getName(), "lttng_ust_cyg_profile:func_entry") && Objects.equals(Long.toHexString(addr), "804af97") && Objects.equals(Long.toHexString(cs), "804ab03") && Objects.equals(ctxVtid.longValue(), 594L);
};
/* The event we're looking for is the second event matching the predicate */
CtfTmfEvent ustEvent = (CtfTmfEvent) TmfTraceUtils.getNextEventMatching(experiment, 0, eventFinder, null);
assertNotNull(ustEvent);
long rank = experiment.seekEvent(ustEvent.getTimestamp()).getRank() + 1;
ustEvent = (CtfTmfEvent) TmfTraceUtils.getNextEventMatching(experiment, rank, eventFinder, null);
assertNotNull(ustEvent);
/* Make sure the correct event was retrieved */
assertEquals(ustTrace, ustEvent.getTrace());
assertEquals(1450193715128075054L, ustEvent.getTimestamp().toNanos());
Integer tidFromKernel = KernelThreadInformationProvider.getThreadOnCpu(module, ustEvent.getCPU(), ustEvent.getTimestamp().toNanos());
assertNotNull(tidFromKernel);
assertEquals(594, tidFromKernel.intValue());
}
use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent 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.event.ITmfEvent in project tracecompass by tracecompass.
the class TmfEventTest method testHashCode.
// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
@Test
public void testHashCode() {
ITmfEvent event1 = new TmfEvent(fTrace, ITmfContext.UNKNOWN_RANK, null, null, null);
ITmfEvent event2 = new TmfEvent(fTrace, ITmfContext.UNKNOWN_RANK, null, null, null);
assertTrue("hashCode", event1.hashCode() == event2.hashCode());
final ITmfTrace trace = fTrace;
event1 = new TmfEvent(trace, 0, fTimestamp1, fType, fContent1);
event2 = new TmfEvent(trace, 1, fTimestamp2, fType, fContent2);
final ITmfEvent event1b = new TmfEvent(event1);
final ITmfEvent event2b = new TmfEvent(event2);
assertTrue("hashCode", event1.hashCode() == event1b.hashCode());
assertTrue("hashCode", event2.hashCode() == event2b.hashCode());
assertTrue("hashCode", event1.hashCode() != event2.hashCode());
assertTrue("hashCode", event2.hashCode() != event1.hashCode());
trace.dispose();
}
use of org.eclipse.tracecompass.tmf.core.event.ITmfEvent 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.event.ITmfEvent in project tracecompass by tracecompass.
the class TmfCoalescedEventRequestTest method trigger.
@TmfSignalHandler
public void trigger(final TmfTestTriggerSignal signal) {
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
final long REQUEST_OFFSET = 1000;
requestedEvents1 = new Vector<>();
request1 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
if (!isCompleted()) {
requestedEvents1.add(event);
if (signal.forceCancel) {
cancel();
}
}
}
};
requestedEvents2 = new Vector<>();
request2 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex + REQUEST_OFFSET, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
if (!isCompleted()) {
requestedEvents2.add(event);
}
}
};
requestedEvents3 = new Vector<>();
request3 = new TmfEventRequest(ITmfEvent.class, range, signal.fIndex + 2 * REQUEST_OFFSET, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
if (!isCompleted()) {
requestedEvents3.add(event);
}
}
};
providers = TmfProviderManager.getProviders(ITmfEvent.class, TmfTraceStub.class);
providers[0].sendRequest(request1);
providers[0].sendRequest(request2);
providers[0].sendRequest(request3);
}
Aggregations