Search in sources :

Example 21 with ITmfTrace

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

the class AbstractProviderTest method tearDown.

/**
 * Perform post-class clean-up.
 */
@After
public void tearDown() {
    fModule.dispose();
    ITmfTrace trace = fTrace;
    if (trace != null) {
        LttngUstTestTraceUtils.dispose(getTestTrace());
        File suppDir = new File(TmfTraceManager.getSupplementaryFileDir(trace));
        deleteDirectory(suppDir);
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) File(java.io.File) After(org.junit.After)

Example 22 with ITmfTrace

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

the class UstMemoryAnalysisModule method executeAnalysis.

@Override
protected boolean executeAnalysis(IProgressMonitor monitor) {
    if (!super.executeAnalysis(monitor)) {
        return false;
    }
    ITmfTrace trace = checkNotNull(getTrace());
    // $NON-NLS-1$
    String segmentFileName = getSsFileName() + ".seg";
    /* See if the data file already exists on disk */
    String dir = TmfTraceManager.getSupplementaryFileDir(trace);
    final Path file = Paths.get(dir, segmentFileName);
    boolean needsBuilding = true;
    Map<Long, MemoryAllocation> unfreedMemory = fPotentialLeaks;
    if (unfreedMemory == null || unfreedMemory.isEmpty()) {
        needsBuilding = false;
    }
    ISegmentStore<@NonNull ISegment> segmentStore = null;
    try {
        if (needsBuilding) {
            Files.deleteIfExists(file);
        }
        segmentStore = SegmentStoreFactory.createOnDiskSegmentStore(file, PotentialLeakSegment.MEMORY_SEGMENT_READ_FACTORY, 1);
    } catch (IOException e) {
        return false;
    }
    if (needsBuilding) {
        fillStore(segmentStore, unfreedMemory);
    }
    fSegmentStore = segmentStore;
    sendUpdate(segmentStore);
    return true;
}
Also used : Path(java.nio.file.Path) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) MemoryAllocation(org.eclipse.tracecompass.internal.lttng2.ust.core.analysis.memory.UstMemoryStateProvider.MemoryAllocation) ISegment(org.eclipse.tracecompass.segmentstore.core.ISegment) NonNullUtils.nullToEmptyString(org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString) IOException(java.io.IOException)

Example 23 with ITmfTrace

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

the class TmfStateValueScenarioTest method setUp.

/**
 * Initializes the trace and the module for the tests
 *
 * @throws TmfAnalysisException
 *             Any exception thrown during module initialization
 */
@Before
public void setUp() throws TmfAnalysisException {
    ITmfTrace trace = XmlUtilsTest.initializeTrace(TEST_TRACE);
    XmlPatternAnalysis module = XmlUtilsTest.initializePatternModule(TmfXmlTestFiles.STATE_VALUE_PATTERN_FILE);
    module.setTrace(trace);
    module.schedule();
    module.waitForCompletion();
    fTrace = trace;
    fModule = module;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) XmlPatternAnalysis(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternAnalysis) Before(org.junit.Before)

Example 24 with ITmfTrace

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

the class TmfStateValueTest method setUp.

/**
 * Initializes the trace and the module for the tests
 *
 * @throws TmfAnalysisException
 *             Any exception thrown during module initialization
 */
@Before
public void setUp() throws TmfAnalysisException {
    ITmfTrace trace = XmlUtilsTest.initializeTrace(TEST_TRACE);
    fTrace = trace;
    DataDrivenAnalysisModule module = XmlUtilsTest.initializeModule(TmfXmlTestFiles.STATE_VALUE_FILE);
    fModule = module;
    module.setTrace(trace);
    module.schedule();
    module.waitForCompletion();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) DataDrivenAnalysisModule(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule) Before(org.junit.Before)

Example 25 with ITmfTrace

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

the class XmlSegmentTest method testSegmentContent.

/**
 * Test segment generated using a mapping group
 *
 * @throws TmfAnalysisException
 *             Exception thrown by analysis
 */
@Test
public void testSegmentContent() throws TmfAnalysisException {
    ITmfTrace trace = getTrace(TEST_TRACE2);
    XmlPatternAnalysis module = null;
    try {
        module = initializeModule(trace, TmfXmlTestFiles.VALID_PATTERN_SEGMENT);
        doTestSegmentContent(module);
        // Close the segment store and open it again, it should read the
        // segment store from disk this time
        module.dispose();
        module = initializeModule(trace, TmfXmlTestFiles.VALID_PATTERN_SEGMENT);
        doTestSegmentContent(module);
    } finally {
        if (module != null) {
            module.dispose();
        }
        deleteSupplementaryFiles(trace);
        trace.dispose();
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) XmlPatternAnalysis(org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternAnalysis) Test(org.junit.Test) XmlUtilsTest(org.eclipse.tracecompass.tmf.analysis.xml.core.tests.module.XmlUtilsTest)

Aggregations

ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)352 Test (org.junit.Test)120 NonNull (org.eclipse.jdt.annotation.NonNull)47 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)45 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)33 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)27 ITmfContext (org.eclipse.tracecompass.tmf.core.trace.ITmfContext)27 Nullable (org.eclipse.jdt.annotation.Nullable)25 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)25 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)23 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)22 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)22 File (java.io.File)21 BeforeClass (org.junit.BeforeClass)21 ArrayList (java.util.ArrayList)20 ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)19 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)17 TmfAnalysisException (org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException)15 TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)15 TmfTrace (org.eclipse.tracecompass.tmf.core.trace.TmfTrace)15