Search in sources :

Example 1 with ISegmentStoreProvider

use of org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider in project tracecompass by tracecompass.

the class PatternProvidersTest method testSegmentStore.

/**
 * Test the generated segment store
 */
@Test
public void testSegmentStore() {
    TmfAbstractAnalysisModule module = getModule();
    if (module instanceof ITmfAnalysisModuleWithStateSystems) {
        // In this test, the module will be XmlPatternAnalysis which is an instance of ITmfAnalysisModuleWithStateSystems
        assertTrue(((ITmfAnalysisModuleWithStateSystems) module).waitForInitialization());
    }
    assertTrue(module.waitForCompletion());
    ISegmentStore<@NonNull ISegment> ss = ((ISegmentStoreProvider) module).getSegmentStore();
    assertNotNull(ss);
    assertFalse(ss.isEmpty());
}
Also used : ISegmentStoreProvider(org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider) ISegment(org.eclipse.tracecompass.segmentstore.core.ISegment) TmfAbstractAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule) ITmfAnalysisModuleWithStateSystems(org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems) Test(org.junit.Test)

Example 2 with ISegmentStoreProvider

use of org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider in project tracecompass by tracecompass.

the class AbstractSegmentStatisticsAnalysis method getDependentAnalyses.

@Override
protected Iterable<IAnalysisModule> getDependentAnalyses() {
    ITmfTrace trace = getTrace();
    if (trace != null) {
        ISegmentStoreProvider provider = getSegmentProviderAnalysis(trace);
        fSegmentStoreProviderModule = provider;
        if (provider instanceof IAnalysisModule) {
            return ImmutableList.of((IAnalysisModule) provider);
        }
    }
    return super.getDependentAnalyses();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) ISegmentStoreProvider(org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)

Example 3 with ISegmentStoreProvider

use of org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider in project tracecompass by tracecompass.

the class AbstractSegmentStatisticsAnalysis method getSegmentStore.

/**
 * Get the segment store from which we want the statistics
 *
 * @return The segment store
 */
@Nullable
private Iterable<@NonNull ISegment> getSegmentStore(long start, long end) {
    ISegmentStoreProvider segmentStoreProviderModule = fSegmentStoreProviderModule;
    if (segmentStoreProviderModule == null) {
        return null;
    }
    if (segmentStoreProviderModule instanceof IAnalysisModule) {
        ((IAnalysisModule) segmentStoreProviderModule).waitForCompletion();
    }
    long t0 = Long.min(start, end);
    long t1 = Long.max(start, end);
    ISegmentStore<@NonNull ISegment> segmentStore = segmentStoreProviderModule.getSegmentStore();
    return segmentStore != null ? isEternity(t0, t1) ? segmentStore : segmentStore.getIntersectingElements(t0, t1) : Collections.emptyList();
}
Also used : ISegmentStoreProvider(org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) ISegment(org.eclipse.tracecompass.segmentstore.core.ISegment) Nullable(org.eclipse.jdt.annotation.Nullable)

Example 4 with ISegmentStoreProvider

use of org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider in project tracecompass by tracecompass.

the class SegmentTableTest method getSegStoreProvider.

/**
 * get the segment store provider
 *
 * @return the segment store provider
 */
protected ISegmentStoreProvider getSegStoreProvider() {
    ISegmentStoreProvider ssp = fSsp;
    if (ssp == null) {
        ssp = new SimpleSegmentStoreProvider();
        fSsp = ssp;
    }
    return ssp;
}
Also used : ISegmentStoreProvider(org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider)

Example 5 with ISegmentStoreProvider

use of org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider in project tracecompass by tracecompass.

the class AbstractSegmentStoreScatterChartTreeViewer2 method getProvider.

@Override
@Nullable
protected ITmfTreeDataProvider<@NonNull ITmfTreeDataModel> getProvider(@NonNull ITmfTrace trace) {
    String analysisId = getAnalysisId();
    /* Support legacy code, get the analysis ID of the segment store */
    if (analysisId.isEmpty()) {
        return null;
    }
    /* End support of legacy */
    // TODO: Find another mechanism to update the view rather than listeners, so
    // that we don't need to expose the analysis to the view
    IAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(trace, IAnalysisModule.class, analysisId);
    if (!(module instanceof ISegmentStoreProvider)) {
        return null;
    }
    fSegmentProvider = (ISegmentStoreProvider) module;
    ((ISegmentStoreProvider) module).addListener(fListener);
    return DataProviderManager.getInstance().getDataProvider(trace, SegmentStoreScatterDataProvider.ID + ':' + analysisId, ITmfTreeXYDataProvider.class);
}
Also used : ISegmentStoreProvider(org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider) IAnalysisModule(org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule) Nullable(org.eclipse.jdt.annotation.Nullable)

Aggregations

ISegmentStoreProvider (org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider)19 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)12 ISegment (org.eclipse.tracecompass.segmentstore.core.ISegment)8 Nullable (org.eclipse.jdt.annotation.Nullable)7 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)6 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5 Map (java.util.Map)4 Predicate (java.util.function.Predicate)4 NonNull (org.eclipse.jdt.annotation.NonNull)4 VisibleForTesting (com.google.common.annotations.VisibleForTesting)3 Format (java.text.Format)3 Entry (java.util.Map.Entry)3 Objects (java.util.Objects)3 Set (java.util.Set)3 SWT (org.eclipse.swt.SWT)3 NonNullUtils.nullToEmptyString (org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString)3 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)3 Arrays (java.util.Arrays)2