Search in sources :

Example 41 with TmfAnalysisException

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

the class KernelAnalysisBenchmark method runTest.

private static void runTest(@NonNull CtfTestTrace testTrace, String testName, TestModule testModule) {
    Performance perf = Performance.getDefault();
    PerformanceMeter pm = perf.createPerformanceMeter(TEST_ID + testName + testModule.getTestNameString());
    perf.tagAsSummary(pm, "LTTng Kernel Analysis: " + testName + testModule.getTestNameString(), Dimension.CPU_TIME);
    if ((testTrace == CtfTestTrace.TRACE2) && (testModule == TestModule.NORMAL_EXECUTION)) {
        /* Do not show all traces in the global summary */
        perf.tagAsGlobalSummary(pm, "LTTng Kernel Analysis" + testModule.getTestNameString() + ": " + testName, Dimension.CPU_TIME);
    }
    for (int i = 0; i < LOOP_COUNT; i++) {
        LttngKernelTrace trace = null;
        IAnalysisModule module = null;
        // TODO Allow the utility method to instantiate trace sub-types
        // directly.
        String path = CtfTmfTestTraceUtils.getTrace(testTrace).getPath();
        try {
            trace = new LttngKernelTrace();
            module = TestModule.getNewModule(testModule);
            module.setId("test");
            trace.initTrace(null, path, CtfTmfEvent.class);
            module.setTrace(trace);
            pm.start();
            TmfTestHelper.executeAnalysis(module);
            pm.stop();
            /*
                 * Delete the supplementary files, so that the next iteration
                 * rebuilds the state system.
                 */
            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();
    CtfTmfTestTraceUtils.dispose(testTrace);
}
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 42 with TmfAnalysisException

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

the class CPUAnalysisBenchmark method runTest.

private void runTest(String testTrace, String testName, int loopCount) throws TmfTraceException {
    assertNotNull(testTrace);
    /* First, initialize the trace and run the required analysis */
    LttngKernelTrace trace = new LttngKernelTrace();
    try {
        deleteSupplementaryFiles(trace);
        initializeTrace(testTrace, trace);
        /* Benchmark the CPU usage module */
        benchmarkCPUModule(testName, trace, loopCount);
        deleteSupplementaryFiles(trace);
    } catch (TmfAnalysisException e) {
        fail(e.getMessage());
    } finally {
        trace.dispose();
    }
}
Also used : TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) LttngKernelTrace(org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace)

Example 43 with TmfAnalysisException

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

the class CallGraphStatisticsDataProviderFactory method createProvider.

@Override
@Nullable
public ITmfTreeDataProvider<? extends ITmfTreeDataModel> createProvider(ITmfTrace trace) {
    if (trace instanceof TmfExperiment) {
        return TmfTreeCompositeDataProvider.create(TmfTraceManager.getTraceSet(trace), ID);
    }
    Iterator<CallStackAnalysis> csModules = TmfTraceUtils.getAnalysisModulesOfClass(trace, CallStackAnalysis.class).iterator();
    if (!csModules.hasNext()) {
        return null;
    }
    CallStackAnalysis csModule = csModules.next();
    csModule.schedule();
    ICallGraphProvider cgModule = csModule.getCallGraph();
    if (!(cgModule instanceof CallGraphAnalysis)) {
        return null;
    }
    CallGraphStatisticsAnalysis statisticsAnalysis = new CallGraphStatisticsAnalysis();
    try {
        statisticsAnalysis.setTrace(trace);
    } catch (TmfAnalysisException e) {
        statisticsAnalysis.dispose();
        return null;
    }
    statisticsAnalysis.schedule();
    SegmentStoreStatisticsDataProvider dp = new SegmentStoreStatisticsDataProvider(trace, statisticsAnalysis, CallGraphStatisticsAnalysis.ID);
    SymbolFormatter fe = new SymbolFormatter(trace);
    dp.setLabelMapper(fe);
    return dp;
}
Also used : ICallGraphProvider(org.eclipse.tracecompass.analysis.profiling.core.callgraph.ICallGraphProvider) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) SegmentStoreStatisticsDataProvider(org.eclipse.tracecompass.internal.analysis.timing.core.segmentstore.SegmentStoreStatisticsDataProvider) CallStackAnalysis(org.eclipse.tracecompass.analysis.profiling.core.callstack.CallStackAnalysis) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 44 with TmfAnalysisException

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

the class StateSystemInMemoryTest method initialize.

/**
 * Test class setup
 */
@BeforeClass
public static void initialize() {
    CtfTmfTrace thetrace = CtfTmfTestTraceUtils.getTrace(testTrace);
    trace = thetrace;
    module = new TestLttngKernelAnalysisModule();
    try {
        assertTrue(module.setTrace(thetrace));
    } catch (TmfAnalysisException e) {
        fail();
    }
    module.schedule();
    assertTrue(module.waitForCompletion());
    fixture = module.getStateSystem();
}
Also used : TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) CtfTmfTrace(org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace) BeforeClass(org.junit.BeforeClass)

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