Search in sources :

Example 6 with TmfAnalysisException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException in project tracecompass by tracecompass.

the class LttngTraceAnalysisBenchmark method runOneBenchmark.

private static void runOneBenchmark(@NonNull CtfTmfTrace testTrace, String testName, runMethod method, Dimension dimension, Supplier<IAnalysisModule> moduleSupplier) {
    Performance perf = Performance.getDefault();
    PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName);
    perf.tagAsSummary(pm, "Trace Compass Analysis " + testName, dimension);
    for (int i = 0; i < LOOP_COUNT; i++) {
        LttngKernelTrace trace = null;
        IAnalysisModule module = null;
        String path = testTrace.getPath();
        try {
            trace = new LttngKernelTrace();
            module = moduleSupplier.get();
            module.setId("test");
            trace.initTrace(null, path, CtfTmfEvent.class);
            module.setTrace(trace);
            method.execute(pm, module);
            File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
            for (File file : suppDir.listFiles()) {
                file.delete();
            }
        } catch (TmfAnalysisException | TmfTraceException e) {
            fail(e.getMessage());
        } finally {
            if (module != null) {
                module.dispose();
            }
            if (trace != null) {
                trace.dispose();
            }
        }
    }
    pm.commit();
}
Also used : IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) PerformanceMeter(org.eclipse.test.performance.PerformanceMeter) LttngKernelTrace(org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace) Performance(org.eclipse.test.performance.Performance) File(java.io.File)

Example 7 with TmfAnalysisException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException in project tracecompass by tracecompass.

the class KernelAnalysisUsageBenchmark method getModule.

private static KernelAnalysisModule getModule(@NonNull CtfTestTrace testTrace, @NonNull LttngKernelTrace trace) {
    KernelAnalysisModule module = null;
    String path = CtfTmfTestTraceUtils.getTrace(testTrace).getPath();
    try {
        /* Initialize the analysis module */
        module = new KernelAnalysisModule();
        module.setId("test");
        trace.initTrace(null, path, CtfTmfEvent.class);
        module.setTrace(trace);
        TmfTestHelper.executeAnalysis(module);
    } catch (TmfAnalysisException | TmfTraceException e) {
        fail(e.getMessage());
    }
    return module;
}
Also used : TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) KernelAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule)

Example 8 with TmfAnalysisException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException in project tracecompass by tracecompass.

the class TidAnalysisUsageBenchmark method getModule.

private static TidAnalysisModule getModule(@NonNull CtfTestTrace testTrace, @NonNull LttngKernelTrace trace) {
    TidAnalysisModule module = null;
    String path = CtfTmfTestTraceUtils.getTrace(testTrace).getPath();
    try {
        /* Initialize the analysis module */
        module = new TidAnalysisModule();
        module.setId("test");
        trace.initTrace(null, path, CtfTmfEvent.class);
        module.setTrace(trace);
        TmfTestHelper.executeAnalysis(module);
    } catch (TmfAnalysisException | TmfTraceException e) {
        fail(e.getMessage());
    }
    return module;
}
Also used : TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) TmfTraceException(org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException) TidAnalysisModule(org.eclipse.tracecompass.analysis.os.linux.core.tid.TidAnalysisModule)

Example 9 with TmfAnalysisException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException in project tracecompass by tracecompass.

the class StateSystemFullHistoryTest method testBuild.

// ------------------------------------------------------------------------
// Tests specific to a full-history
// ------------------------------------------------------------------------
/**
 * Rebuild independently so we can benchmark it. Too bad JUnit doesn't allow
 * us to @Test the @BeforeClass...
 */
@Test
public void testBuild() {
    TestLttngKernelAnalysisModule module2 = new TestLttngKernelAnalysisModule(BENCHMARK_FILE_NAME);
    try {
        assertTrue(module2.setTrace(trace));
    } catch (TmfAnalysisException e) {
        module2.dispose();
        fail();
    }
    module2.schedule();
    assertTrue(module2.waitForCompletion());
    ITmfStateSystem ssb2 = module2.getStateSystem();
    assertNotNull(ssb2);
    assertEquals(startTime, ssb2.getStartTime());
    assertEquals(endTime, ssb2.getCurrentEndTime());
    module2.dispose();
}
Also used : TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test)

Example 10 with TmfAnalysisException

use of org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException in project tracecompass by tracecompass.

the class StateSystemFullHistoryTest method testOpenExistingStateFile.

/**
 * Test re-opening the existing file.
 */
@Test
public void testOpenExistingStateFile() {
    /* 'newStateFile' should have already been created */
    TestLttngKernelAnalysisModule module2 = new TestLttngKernelAnalysisModule(TEST_FILE_NAME);
    try {
        assertTrue(module2.setTrace(trace));
    } catch (TmfAnalysisException e) {
        module2.dispose();
        fail();
    }
    module2.schedule();
    assertTrue(module2.waitForCompletion());
    ITmfStateSystem ssb2 = module2.getStateSystem();
    assertNotNull(ssb2);
    assertEquals(startTime, ssb2.getStartTime());
    assertEquals(endTime, ssb2.getCurrentEndTime());
    module2.dispose();
}
Also used : TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test)

Aggregations

TmfAnalysisException (org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException)44 Test (org.junit.Test)21 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)15 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)14 TestAnalysis (org.eclipse.tracecompass.tmf.tests.stubs.analysis.TestAnalysis)9 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)8 TmfTraceException (org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException)8 File (java.io.File)7 LttngKernelTrace (org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace)6 IStatus (org.eclipse.core.runtime.IStatus)5 Performance (org.eclipse.test.performance.Performance)5 PerformanceMeter (org.eclipse.test.performance.PerformanceMeter)5 BeforeClass (org.junit.BeforeClass)5 CtfTmfTrace (org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)4 Nullable (org.eclipse.jdt.annotation.Nullable)3 DataDrivenAnalysisModule (org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule)3 XmlUtilsTest (org.eclipse.tracecompass.tmf.analysis.xml.core.tests.module.XmlUtilsTest)3 IAnalysisModuleHelper (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModuleHelper)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2