Search in sources :

Example 51 with TmfExperiment

use of org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment 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 52 with TmfExperiment

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

the class ExperimentSyncTest method testExperimentSync.

/**
 * Testing experiment synchronization
 */
@Test
public void testExperimentSync() {
    CtfTmfTrace trace1 = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.SYNC_SRC);
    CtfTmfTrace trace2 = CtfTmfTestTraceUtils.getTrace(CtfTestTrace.SYNC_DEST);
    ITmfTrace[] traces = { trace1, trace2 };
    TmfExperiment experiment = new TmfExperiment(traces[0].getEventType(), EXPERIMENT, traces, BLOCK_SIZE, null);
    SynchronizationAlgorithm syncAlgo = experiment.synchronizeTraces(true);
    ITmfTimestampTransform tt1 = syncAlgo.getTimestampTransform(trace1);
    ITmfTimestampTransform tt2 = syncAlgo.getTimestampTransform(trace2);
    trace1.setTimestampTransform(tt1);
    trace2.setTimestampTransform(tt2);
    assertEquals("TmfTimestampTransformLinearFast [ slope = 0.9999413783703139011056845831168394, offset = 79796507913179.33347660124688298171 ]", tt1.toString());
    assertEquals(TimestampTransformFactory.getDefaultTransform(), tt2);
    assertEquals(syncAlgo.getTimestampTransform(trace1.getHostId()), trace1.getTimestampTransform());
    assertEquals(syncAlgo.getTimestampTransform(trace2.getHostId()), trace2.getTimestampTransform());
    experiment.dispose();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) ITmfTimestampTransform(org.eclipse.tracecompass.tmf.core.synchronization.ITmfTimestampTransform) CtfTmfTrace(org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace) SynchronizationAlgorithm(org.eclipse.tracecompass.tmf.core.synchronization.SynchronizationAlgorithm) Test(org.junit.Test)

Example 53 with TmfExperiment

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

the class XmlDataProviderManager method getTimeGraphProvider.

/**
 * Create (if necessary) and get the time graph data provider for the
 * specified trace and viewElement.
 *
 * @param trace
 *            trace for which we are querying a provider
 * @param viewElement
 *            the XML time graph view element for which we are querying a
 *            provider
 * @return the unique instance of a time graph provider for the queried
 *         parameters
 */
@Nullable
public synchronized ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> getTimeGraphProvider(ITmfTrace trace, Element viewElement) {
    if (!viewElement.hasAttribute(ID_ATTRIBUTE)) {
        return null;
    }
    String viewId = viewElement.getAttribute(ID_ATTRIBUTE);
    ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> provider = fTimeGraphProviders.get(trace, viewId);
    if (provider != null) {
        return provider;
    }
    if (Iterables.any(TmfTraceManager.getInstance().getOpenedTraces(), opened -> TmfTraceManager.getTraceSetWithExperiment(opened).contains(trace))) {
        // Create with the trace or experiment first
        TmfXmlTimeGraphViewCu tgViewCu = TmfXmlTimeGraphViewCu.compile(new AnalysisCompilationData(), viewElement);
        if (tgViewCu != null) {
            DataDrivenTimeGraphProviderFactory timeGraphFactory = tgViewCu.generate();
            provider = timeGraphFactory.create(trace);
            if (provider == null) {
                // composite if that's the case
                if (trace instanceof TmfExperiment) {
                    provider = generateExperimentProviderTimeGraph(TmfTraceManager.getTraceSet(trace), viewElement);
                }
            }
            if (provider != null) {
                fTimeGraphProviders.put(trace, viewId, provider);
            }
            return provider;
        }
    }
    return null;
}
Also used : TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) TimeGraphEntryModel(org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel) TmfXmlTimeGraphViewCu(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.TmfXmlTimeGraphViewCu) AnalysisCompilationData(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.AnalysisCompilationData) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 54 with TmfExperiment

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

the class TraceAnnotationProvider method init.

private void init(ITmfTrace trace) {
    if (trace instanceof TmfExperiment) {
        @NonNull Collection<@NonNull ITmfTrace> traces = TmfTraceManager.getTraceSet(trace);
        for (ITmfTrace child : traces) {
            init(child);
        }
        return;
    }
    List<@NonNull IOutputAnnotationProvider> adapters = TmfTraceAdapterManager.getAdapters(trace, IOutputAnnotationProvider.class);
    fTraceAnnotations.addAll(adapters);
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) NonNull(org.eclipse.jdt.annotation.NonNull)

Example 55 with TmfExperiment

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

the class TraceAndExperimentTypeTest method testDefaultExperimentType.

/**
 * Test whether a newly created experiment has the default experiment type,
 * even though none was specified
 */
@Test
public void testDefaultExperimentType() {
    TmfExperimentElement experimentElement = ProjectModelTestData.addExperiment(fixture, "testDefaultExpType");
    assertNotNull(experimentElement);
    TmfExperiment experiment = experimentElement.instantiateTrace();
    assertNotNull(experiment);
    assertEquals(TmfTraceType.DEFAULT_EXPERIMENT_TYPE, experimentElement.getTraceType());
    experiment.dispose();
}
Also used : TmfExperiment(org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment) TmfExperimentElement(org.eclipse.tracecompass.tmf.ui.project.model.TmfExperimentElement) Test(org.junit.Test)

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