Search in sources :

Example 46 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class TmfExperimentTest method testSeekNoTrace.

@Test
public void testSeekNoTrace() {
    TmfExperiment experiment = new TmfExperiment(ITmfEvent.class, EXPERIMENT, null, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
    ITmfContext context = experiment.seekEvent((TmfExperimentLocation) null);
    validateContextRanks(context);
    experiment.dispose();
}
Also used : ITmfContext(org.eclipse.tracecompass.tmf.core.trace.ITmfContext) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) AnalysisManagerTest(org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest) Test(org.junit.Test)

Example 47 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class DataProviderManagerTest method init.

/**
 * Test Class setup
 */
@BeforeClass
public static void init() {
    DataProviderManager.getInstance();
    // Open kernel trace
    fKernelTrace = LttngKernelTestTraceUtils.getTrace(CtfTestTrace.KERNEL);
    // Open UST trace
    fUstTrace = LttngUstTestTraceUtils.getTrace(CtfTestTrace.CYG_PROFILE);
    // Open experiment with kernel and UST trace
    ITmfTrace[] traces = { fKernelTrace, fUstTrace };
    fExperiment = new TmfExperiment(ITmfEvent.class, "TextExperiment", traces, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
    TmfTraceOpenedSignal openTraceSignal = new TmfTraceOpenedSignal(fExperiment, fExperiment, null);
    TmfSignalManager.dispatchSignal(openTraceSignal);
    fExperiment.indexTrace(true);
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TmfTraceOpenedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal) BeforeClass(org.junit.BeforeClass)

Example 48 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class TmfTraceTest method testGetUUID.

/**
 * Test getUUID()
 *
 * @throws TmfTraceException
 *             won't happen
 */
@Test
public void testGetUUID() throws TmfTraceException {
    TmfTraceStub trace = null;
    trace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
    // UUIDs should be seen as hashcodes, a match heavily implies that the
    // traces are the same.
    // Here we confirm two traces pointing to the same file return the same
    // UUID. The UUID is not hardcoded as it will change from one machine to
    // another depending on the checkout date.
    assertEquals(fTrace.getUUID(), trace.getUUID());
    trace.dispose();
    // Here the trace file is different. The UUID should no longer be the
    // same.
    trace = new TmfTraceStub(TmfTestTrace.A_TEST_10K2.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null);
    assertNotEquals(fTrace.getUUID(), trace.getUUID());
    ITmfTrace[] traces = { fTrace, trace };
    TmfExperiment exp = new TmfExperiment(ITmfEvent.class, "", traces, 1, null);
    assertNotEquals(fTrace.getUUID(), exp.getUUID());
    trace.dispose();
    exp.dispose();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) TmfTraceStub(org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub) Test(org.junit.Test)

Example 49 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class TmfAnalysisModuleHelperConfigElement method newModule.

@Override
public IAnalysisModule newModule(ITmfTrace trace) throws TmfAnalysisException {
    /* Check if it applies to trace itself */
    Boolean applies = appliesToTraceClass(trace.getClass());
    /*
         * If the trace is an experiment, check if this module would apply to an
         * experiment should it apply to one of its traces.
         */
    if (applies == null && (trace instanceof TmfExperiment) && appliesToExperiment()) {
        for (ITmfTrace expTrace : TmfTraceManager.getTraceSet(trace)) {
            if (appliesToTraceClass(expTrace.getClass()) == Boolean.TRUE) {
                applies = true;
                break;
            }
        }
    }
    if (applies != Boolean.TRUE) {
        return null;
    }
    IAnalysisModule module = createModule();
    if (module == null) {
        return null;
    }
    module.setAutomatic(isAutomatic());
    /* Get the module's parameters */
    final IConfigurationElement[] parametersCE = fCe.getChildren(TmfAnalysisModuleSourceConfigElement.PARAMETER_ELEM);
    for (IConfigurationElement element : parametersCE) {
        String paramName = element.getAttribute(TmfAnalysisModuleSourceConfigElement.NAME_ATTR);
        if (paramName == null) {
            continue;
        }
        module.addParameter(paramName);
        String defaultValue = element.getAttribute(TmfAnalysisModuleSourceConfigElement.DEFAULT_VALUE_ATTR);
        if (defaultValue != null) {
            module.setParameter(paramName, defaultValue);
        }
    }
    if (module.setTrace(trace)) {
        TmfAnalysisManager.analysisModuleCreated(module);
    } else {
        module.dispose();
        module = null;
    }
    return module;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) IConfigurationElement(org.eclipse.core.runtime.IConfigurationElement)

Example 50 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment in project tracecompass by tracecompass.

the class CallStackDataProviderFactoryTest method setup.

/**
 * Test class setup
 */
@BeforeClass
public static void setup() {
    fTraceData1 = new TestDataSmallCallStack();
    fTraceData2 = new TestDataBigCallStack();
    TmfXmlTraceStub trace1 = (TmfXmlTraceStub) fTraceData1.getTrace();
    TmfXmlTraceStub trace2 = (TmfXmlTraceStub) fTraceData2.getTrace();
    CallStackAnalysisStub module = TmfTraceUtils.getAnalysisModuleOfClass(trace1, CallStackAnalysisStub.class, CallStackAnalysisStub.ID);
    assertNotNull(module);
    module = TmfTraceUtils.getAnalysisModuleOfClass(trace2, CallStackAnalysisStub.class, CallStackAnalysisStub.ID);
    assertNotNull(module);
    ITmfTrace[] traces = new ITmfTrace[1];
    traces[0] = trace1;
    fExperimentSingleTrace = new TmfExperiment(ITmfEvent.class, "experiment", traces, 1000, null);
    traces = new ITmfTrace[2];
    traces[0] = trace1;
    traces[1] = trace2;
    fExperiment = new TmfExperiment(ITmfEvent.class, "experiment", traces, 1000, null);
    fFactory = new CallStackDataProviderFactory();
}
Also used : CallStackAnalysisStub(org.eclipse.tracecompass.analysis.profiling.core.tests.stubs.CallStackAnalysisStub) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfXmlTraceStub(org.eclipse.tracecompass.tmf.tests.stubs.trace.xml.TmfXmlTraceStub) TestDataBigCallStack(org.eclipse.tracecompass.analysis.profiling.core.tests.data.TestDataBigCallStack) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) CallStackDataProviderFactory(org.eclipse.tracecompass.internal.analysis.profiling.core.callstack.provider.CallStackDataProviderFactory) ITmfEvent(org.eclipse.tracecompass.tmf.core.event.ITmfEvent) TestDataSmallCallStack(org.eclipse.tracecompass.analysis.profiling.core.tests.data.TestDataSmallCallStack) BeforeClass(org.junit.BeforeClass)

Aggregations

TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)55 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)33 Test (org.junit.Test)31 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)11 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)9 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)8 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)7 AnalysisManagerTest (org.eclipse.tracecompass.tmf.core.tests.analysis.AnalysisManagerTest)7 CtfTmfTrace (org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)7 Nullable (org.eclipse.jdt.annotation.Nullable)5 IConfigurationElement (org.eclipse.core.runtime.IConfigurationElement)4 NonNull (org.eclipse.jdt.annotation.NonNull)3 KernelAnalysisModule (org.eclipse.tracecompass.analysis.os.linux.core.kernel.KernelAnalysisModule)3 TmfTraceClosedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal)3 TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)3 ITmfTimestampTransform (org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform)3 SynchronizationAlgorithm (org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm)3 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)3 CtfTmfEvent (org.eclipse.tracecompass.tmf.ctf.core.event.CtfTmfEvent)3 Before (org.junit.Before)3