Search in sources :

Example 1 with LttngUstTrace

use of org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace in project tracecompass by tracecompass.

the class CallStackAndGraphBenchmark method getTrace.

private TmfTrace getTrace() throws TmfTraceException {
    LttngUstTrace trace = new LttngUstTrace();
    trace.initTrace(null, fTestTrace, ITmfEvent.class);
    return trace;
}
Also used : LttngUstTrace(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace)

Example 2 with LttngUstTrace

use of org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace in project tracecompass by tracecompass.

the class UstDebugInfoAnalysisModuleTest method testGetAllBinaries.

/**
 * Test the {@link UstDebugInfoAnalysisModule#getAllBinaries} method.
 */
@Test
public void testGetAllBinaries() {
    LttngUstTrace trace = LttngUstTestTraceUtils.getTrace(REAL_TEST_TRACE);
    executeModule(trace);
    List<UstDebugInfoBinaryFile> actualBinaries = Lists.newArrayList(fModule.getAllBinaries());
    List<UstDebugInfoBinaryFile> expectedBinaries = Lists.newArrayList(new UstDebugInfoBinaryFile("/home/simark/src/babeltrace/tests/debug-info-data/libhello_so", "cdd98cdd87f7fe64c13b6daad553987eafd40cbb", null, true), new UstDebugInfoBinaryFile("/home/simark/src/babeltrace/tests/debug-info-data/test", "0683255d2cf219c33cc0efd6039db09ccc4416d7", null, false), new UstDebugInfoBinaryFile("[linux-vdso.so.1]", null, null, false), new UstDebugInfoBinaryFile("/usr/local/lib/liblttng-ust-dl.so.0.0.0", "39c035014cc02008d6884fcb1be4e020cc820366", null, true), new UstDebugInfoBinaryFile("/usr/lib/libdl-2.23.so", "db3f9be9f4ebe9e2a21e4ae0b4ef7165d40fdfef", null, true), new UstDebugInfoBinaryFile("/usr/lib/libc-2.23.so", "946025a5cad7b5f2dfbaebc6ebd1fcc004349b48", null, true), new UstDebugInfoBinaryFile("/usr/local/lib/liblttng-ust.so.0.0.0", "405b0b15daa73eccb88076247ba30356c00d3b92", null, true), new UstDebugInfoBinaryFile("/usr/local/lib/liblttng-ust-tracepoint.so.0.0.0", "62c028aad38adb5e0910c527d522e8c86a0a3344", null, true), new UstDebugInfoBinaryFile("/usr/lib/librt-2.23.so", "aba676bda7fb6adb71e100159915504e1a0c17e6", null, true), new UstDebugInfoBinaryFile("/usr/lib/liburcu-bp.so.4.0.0", "b9dfadea234107f8453bc636fc160047e0c01b7a", null, true), new UstDebugInfoBinaryFile("/usr/lib/liburcu-cds.so.4.0.0", "420527f6dacc762378d9fa7def54d91c80a6c87e", null, true), new UstDebugInfoBinaryFile("/usr/lib/libpthread-2.23.so", "d91ed99c8425b7ce5da5bb750662a91038e02a78", null, true), new UstDebugInfoBinaryFile("/usr/lib/ld-2.23.so", "524eff0527e923e4adc4be9db1ef7475607b92e8", null, true), new UstDebugInfoBinaryFile("/usr/lib/liburcu-common.so.4.0.0", "f279a6d46a2b846e15e7abd99cfe9fbe8d7f8295", null, true));
    Comparator<UstDebugInfoBinaryFile> comparator = Comparator.comparing(UstDebugInfoBinaryFile::getFilePath);
    actualBinaries.sort(comparator);
    expectedBinaries.sort(comparator);
    /* Highlights failures more easily */
    for (int i = 0; i < expectedBinaries.size(); i++) {
        assertEquals(expectedBinaries.get(i), actualBinaries.get(i));
    }
    assertEquals(actualBinaries, expectedBinaries);
    LttngUstTestTraceUtils.dispose(REAL_TEST_TRACE);
}
Also used : LttngUstTrace(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace) UstDebugInfoBinaryFile(org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryFile) Test(org.junit.Test)

Example 3 with LttngUstTrace

use of org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace 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);
}
Also used : LttngUstTrace(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace) ArrayList(java.util.ArrayList) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) LttngUstEvent(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstEvent) UstDebugInfoBinaryAspect(org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryAspect) UstDebugInfoAnalysisModule(org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAnalysisModule) TmfEventRequest(org.eclipse.tracecompass.tmf.core.request.TmfEventRequest) Test(org.junit.Test)

Example 4 with LttngUstTrace

use of org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace in project tracecompass by tracecompass.

the class UstDebugInfoAnalysisModuleTest method testCannotExcecute.

/**
 * Test that the analysis correctly refuses to execute on an invalid trace
 * (LTTng-UST < 2.8 in this case).
 */
@Test
public void testCannotExcecute() {
    LttngUstTrace invalidTrace = LttngUstTestTraceUtils.getTrace(INVALID_TRACE);
    assertFalse(fModule.canExecute(invalidTrace));
    LttngUstTestTraceUtils.dispose(INVALID_TRACE);
}
Also used : LttngUstTrace(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace) Test(org.junit.Test)

Example 5 with LttngUstTrace

use of org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace in project tracecompass by tracecompass.

the class AbstractProviderTest method setUp.

// ------------------------------------------------------------------------
// Maintenance
// ------------------------------------------------------------------------
/**
 * Perform pre-class initialization.
 */
@Before
public void setUp() {
    CtfTestTrace testTrace = getTestTrace();
    LttngUstTrace trace = LttngUstTestTraceUtils.getTrace(testTrace);
    fTrace = trace;
    fModule = new TestLttngCallStackModule();
    try {
        assertTrue(fModule.setTrace(trace));
    } catch (TmfAnalysisException e) {
        fail();
    }
    fModule.schedule();
    assertTrue(fModule.waitForCompletion());
    fSS = fModule.getStateSystem();
    assertNotNull(fSS);
}
Also used : LttngUstTrace(org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace) TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) CtfTestTrace(org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace) Before(org.junit.Before)

Aggregations

LttngUstTrace (org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace)18 Test (org.junit.Test)8 UstDebugInfoLoadedBinaryFile (org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoLoadedBinaryFile)3 ILttngUstEventLayout (org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout)3 File (java.io.File)2 NonNull (org.eclipse.jdt.annotation.NonNull)2 Nullable (org.eclipse.jdt.annotation.Nullable)2 NonNullUtils.nullToEmptyString (org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString)2 SymbolProviderConfig (org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace.SymbolProviderConfig)2 CtfTestTrace (org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace)2 TmfAbstractAnalysisRequirement (org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAbstractAnalysisRequirement)2 ArrayList (java.util.ArrayList)1 SWTWorkbenchBot (org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot)1 UstDebugInfoAnalysisModule (org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoAnalysisModule)1 UstDebugInfoBinaryAspect (org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryAspect)1 UstDebugInfoBinaryFile (org.eclipse.tracecompass.lttng2.ust.core.analysis.debuginfo.UstDebugInfoBinaryFile)1 LttngUstEvent (org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstEvent)1 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)1 TmfAnalysisEventRequirement (org.eclipse.tracecompass.tmf.core.analysis.requirements.TmfAnalysisEventRequirement)1 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)1