Search in sources :

Example 11 with TmfTraceClosedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal in project tracecompass by tracecompass.

the class XmlTimeGraphDataProviderTest method testNoParentDisplay.

/**
 * Test getting the XML data provider for one trace, with an analysis that
 * applies to a trace
 *
 * @throws IOException
 *             Exception thrown by analyses
 */
@Test
public void testNoParentDisplay() throws IOException {
    ITmfTrace trace = getTrace();
    assertNotNull(trace);
    try {
        runModule(trace);
        // Get the view element from the file
        Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.DATA_PROVIDER_SIMPLE_FILE.getPath().toOSString(), TmfXmlStrings.TIME_GRAPH_VIEW, TIME_GRAPH_VIEW_ID2);
        assertNotNull(viewElement);
        ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> timeGraphProvider = XmlDataProviderManager.getInstance().getTimeGraphProvider(trace, viewElement);
        assertNotNull(timeGraphProvider);
        List<String> expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedTimeGraphTree"));
        Map<Long, String> tree = assertAndGetTree(timeGraphProvider, trace, expectedStrings);
        expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedTimeGraphRows"));
        // The CPU entry does not have entries
        expectedStrings.remove(0);
        assertRows(timeGraphProvider, tree, expectedStrings);
    } finally {
        trace.dispose();
        TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace));
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) Element(org.w3c.dom.Element) TimeGraphEntryModel(org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel) TmfTraceClosedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal) Test(org.junit.Test)

Example 12 with TmfTraceClosedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal in project tracecompass by tracecompass.

the class XmlTimeGraphDataProviderTest method testFactory.

/**
 * Test the {@link DataDrivenTimeGraphProviderFactory} class
 */
@Test
public void testFactory() {
    ITmfTrace trace = getTrace();
    assertNotNull(trace);
    try {
        runModule(trace);
        // Get the view element from the file
        Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.DATA_PROVIDER_SIMPLE_FILE.getPath().toOSString(), TmfXmlStrings.TIME_GRAPH_VIEW, TIME_GRAPH_VIEW_ID);
        assertNotNull(viewElement);
        TmfXmlTimeGraphViewCu tgViewCu = TmfXmlTimeGraphViewCu.compile(new AnalysisCompilationData(), viewElement);
        assertNotNull(tgViewCu);
        DataDrivenTimeGraphProviderFactory timeGraphFactory = tgViewCu.generate();
        // Test the factory with a simple trace
        ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> provider = timeGraphFactory.create(trace);
        assertNotNull(provider);
        assertEquals(DataDrivenTimeGraphDataProvider.ID, provider.getId());
        // Test the factory with an ID and state system
        ITmfAnalysisModuleWithStateSystems module = TmfTraceUtils.getAnalysisModuleOfClass(trace, ITmfAnalysisModuleWithStateSystems.class, ANALYSIS_ID);
        assertNotNull(module);
        Iterable<@NonNull ITmfStateSystem> stateSystems = module.getStateSystems();
        assertNotNull(stateSystems);
        provider = DataDrivenTimeGraphProviderFactory.create(trace, Objects.requireNonNull(Lists.newArrayList(stateSystems)), getEntries(new AnalysisCompilationData(), viewElement), getvalues(viewElement), ANALYSIS_ID);
        assertNotNull(provider);
        assertEquals(ANALYSIS_ID, provider.getId());
    } finally {
        trace.dispose();
        TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace));
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) DataDrivenTimeGraphProviderFactory(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.output.DataDrivenTimeGraphProviderFactory) Element(org.w3c.dom.Element) TmfXmlTimeGraphViewCu(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.TmfXmlTimeGraphViewCu) TimeGraphEntryModel(org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel) AnalysisCompilationData(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.AnalysisCompilationData) TmfTraceClosedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal) ITmfAnalysisModuleWithStateSystems(org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test)

Example 13 with TmfTraceClosedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal in project tracecompass by tracecompass.

the class XmlXyDataProviderTest method testXYFactory.

/**
 * Test the {@link DataDrivenXYProviderFactory} class
 */
@Test
public void testXYFactory() {
    ITmfTrace trace = getTrace();
    assertNotNull(trace);
    try {
        runModule(trace);
        // Get the view element from the file
        Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.DATA_PROVIDER_SIMPLE_FILE.getPath().toOSString(), TmfXmlStrings.XY_VIEW, XY_VIEW_ID_DELTA);
        assertNotNull(viewElement);
        TmfXmlXYViewCu tgViewCu = TmfXmlXYViewCu.compile(new AnalysisCompilationData(), viewElement);
        assertNotNull(tgViewCu);
        DataDrivenXYProviderFactory XYFactory = tgViewCu.generate();
        // Test the factory with a simple trace
        ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> provider = XYFactory.create(trace);
        assertNotNull(provider);
        assertEquals(DataDrivenXYDataProvider.ID, provider.getId());
        // Test the factory with an ID and state system
        ITmfAnalysisModuleWithStateSystems module = TmfTraceUtils.getAnalysisModuleOfClass(trace, ITmfAnalysisModuleWithStateSystems.class, ANALYSIS_ID);
        assertNotNull(module);
        Iterable<@NonNull ITmfStateSystem> stateSystems = module.getStateSystems();
        assertNotNull(stateSystems);
        provider = DataDrivenXYProviderFactory.create(trace, Objects.requireNonNull(Lists.newArrayList(stateSystems)), getEntries(new AnalysisCompilationData(), viewElement), ANALYSIS_ID);
        assertNotNull(provider);
        assertEquals(ANALYSIS_ID, provider.getId());
    } finally {
        trace.dispose();
        TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace));
    }
}
Also used : DataDrivenXYProviderFactory(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.output.DataDrivenXYProviderFactory) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfXmlXYViewCu(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.TmfXmlXYViewCu) ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) Element(org.w3c.dom.Element) AnalysisCompilationData(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.AnalysisCompilationData) TmfTraceClosedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal) ITmfAnalysisModuleWithStateSystems(org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test)

Example 14 with TmfTraceClosedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal in project tracecompass by tracecompass.

the class XmlXyDataProviderTest method testXYDataProviderDelta.

/**
 * Test getting the XML XY data provider for one trace, with an analysis that
 * applies to a trace, and requesting relative values (delta) for the y axis.
 *
 * @throws IOException
 *             Exception thrown by analyses
 */
@Test
public void testXYDataProviderDelta() throws IOException {
    ITmfTrace trace = getTrace();
    assertNotNull(trace);
    try {
        runModule(trace);
        // Get the view element from the file
        Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.DATA_PROVIDER_SIMPLE_FILE.getPath().toOSString(), TmfXmlStrings.XY_VIEW, XY_VIEW_ID_DELTA);
        assertNotNull(viewElement);
        ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> xyProvider = XmlDataProviderManager.getInstance().getXyProvider(trace, viewElement);
        assertNotNull(xyProvider);
        List<String> expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedXYTree"));
        Map<Long, String> tree = assertAndGetTree(xyProvider, trace, expectedStrings);
        expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedXYDataDelta"));
        assertRows(xyProvider, tree, expectedStrings);
    } finally {
        trace.dispose();
        TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace));
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) Element(org.w3c.dom.Element) TmfTraceClosedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal) Test(org.junit.Test)

Example 15 with TmfTraceClosedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal in project tracecompass by tracecompass.

the class XmlXyDataProviderTest method testXYDataProvider.

/**
 * Test getting the XML data provider for one trace, with an analysis that
 * applies to a trace
 *
 * @throws IOException
 *             Exception thrown by analyses
 */
@Test
public void testXYDataProvider() throws IOException {
    ITmfTrace trace = getTrace();
    assertNotNull(trace);
    try {
        runModule(trace);
        // Get the view element from the file
        Element viewElement = TmfXmlUtils.getElementInFile(TmfXmlTestFiles.DATA_PROVIDER_SIMPLE_FILE.getPath().toOSString(), TmfXmlStrings.XY_VIEW, XY_VIEW_ID);
        assertNotNull(viewElement);
        ITmfTreeXYDataProvider<@NonNull ITmfTreeDataModel> xyProvider = XmlDataProviderManager.getInstance().getXyProvider(trace, viewElement);
        assertNotNull(xyProvider);
        List<String> expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedXYTree"));
        Map<Long, String> tree = assertAndGetTree(xyProvider, trace, expectedStrings);
        expectedStrings = Files.readAllLines(Paths.get("test_traces/simple_dataprovider/expectedXYData"));
        assertRows(xyProvider, tree, expectedStrings);
    } finally {
        trace.dispose();
        TmfTraceManager.getInstance().traceClosed(new TmfTraceClosedSignal(this, trace));
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) Element(org.w3c.dom.Element) TmfTraceClosedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal) Test(org.junit.Test)

Aggregations

TmfTraceClosedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceClosedSignal)16 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)10 Test (org.junit.Test)10 Element (org.w3c.dom.Element)10 TimeGraphEntryModel (org.eclipse.tracecompass.tmf.core.model.timegraph.TimeGraphEntryModel)7 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)5 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)4 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)4 ITmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel)3 AnalysisCompilationData (org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.compile.AnalysisCompilationData)2 DataDrivenAnalysisModule (org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule)2 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)2 ITmfAnalysisModuleWithStateSystems (org.eclipse.tracecompass.tmf.core.statesystem.ITmfAnalysisModuleWithStateSystems)2 TmfTraceStub (org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub)2 After (org.junit.After)2 HashMultiset (com.google.common.collect.HashMultiset)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Iterables (com.google.common.collect.Iterables)1 Multiset (com.google.common.collect.Multiset)1 File (java.io.File)1