Search in sources :

Example 1 with ITmfStateSystem

use of org.eclipse.tracecompass.statesystem.core.ITmfStateSystem in project tracecompass by tracecompass.

the class CtfTmfLostEventStatisticsTest method setUp.

// ------------------------------------------------------------------------
// Maintenance
// ------------------------------------------------------------------------
/**
 * Test setup
 */
@BeforeClass
public static void setUp() {
    ITmfTrace trace = CtfTmfTestTraceUtils.getTrace(lostEventsTrace);
    fTrace = trace;
    /* Prepare the two analysis-backed state systems */
    fTotalsMod = new TmfStatisticsTotalsModule();
    fEventTypesMod = new TmfStatisticsEventTypesModule();
    try {
        fTotalsMod.setTrace(trace);
        fEventTypesMod.setTrace(trace);
    } catch (TmfAnalysisException e) {
        fail();
    }
    fTotalsMod.schedule();
    fEventTypesMod.schedule();
    assertTrue(fTotalsMod.waitForCompletion());
    assertTrue(fEventTypesMod.waitForCompletion());
    ITmfStateSystem totalsSS = fTotalsMod.getStateSystem();
    ITmfStateSystem eventTypesSS = fEventTypesMod.getStateSystem();
    assertNotNull(totalsSS);
    assertNotNull(eventTypesSS);
    fStats = new TmfStateStatistics(totalsSS, eventTypesSS);
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfStatisticsTotalsModule(org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsTotalsModule) TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) TmfStateStatistics(org.eclipse.tracecompass.tmf.core.statistics.TmfStateStatistics) TmfStatisticsEventTypesModule(org.eclipse.tracecompass.tmf.core.statistics.TmfStatisticsEventTypesModule) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) BeforeClass(org.junit.BeforeClass)

Example 2 with ITmfStateSystem

use of org.eclipse.tracecompass.statesystem.core.ITmfStateSystem in project tracecompass by tracecompass.

the class StateSystemFullHistoryTest method testBuild.

// ------------------------------------------------------------------------
// Tests specific to a full-history
// ------------------------------------------------------------------------
/**
 * Rebuild independently so we can benchmark it. Too bad JUnit doesn't allow
 * us to @Test the @BeforeClass...
 */
@Test
public void testBuild() {
    TestLttngKernelAnalysisModule module2 = new TestLttngKernelAnalysisModule(BENCHMARK_FILE_NAME);
    try {
        assertTrue(module2.setTrace(trace));
    } catch (TmfAnalysisException e) {
        module2.dispose();
        fail();
    }
    module2.schedule();
    assertTrue(module2.waitForCompletion());
    ITmfStateSystem ssb2 = module2.getStateSystem();
    assertNotNull(ssb2);
    assertEquals(startTime, ssb2.getStartTime());
    assertEquals(endTime, ssb2.getCurrentEndTime());
    module2.dispose();
}
Also used : TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test)

Example 3 with ITmfStateSystem

use of org.eclipse.tracecompass.statesystem.core.ITmfStateSystem in project tracecompass by tracecompass.

the class StateSystemFullHistoryTest method testOpenExistingStateFile.

/**
 * Test re-opening the existing file.
 */
@Test
public void testOpenExistingStateFile() {
    /* 'newStateFile' should have already been created */
    TestLttngKernelAnalysisModule module2 = new TestLttngKernelAnalysisModule(TEST_FILE_NAME);
    try {
        assertTrue(module2.setTrace(trace));
    } catch (TmfAnalysisException e) {
        module2.dispose();
        fail();
    }
    module2.schedule();
    assertTrue(module2.waitForCompletion());
    ITmfStateSystem ssb2 = module2.getStateSystem();
    assertNotNull(ssb2);
    assertEquals(startTime, ssb2.getStartTime());
    assertEquals(endTime, ssb2.getCurrentEndTime());
    module2.dispose();
}
Also used : TmfAnalysisException(org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test)

Example 4 with ITmfStateSystem

use of org.eclipse.tracecompass.statesystem.core.ITmfStateSystem in project tracecompass by tracecompass.

the class StateSystemTest method testRangeQuery2.

/**
 * Range query, but with a t2 far off the end of the trace. The result
 * should still be valid.
 */
@Test
public void testRangeQuery2() {
    List<ITmfStateInterval> intervals;
    final ITmfStateSystem ss = fixture;
    assertNotNull(ss);
    try {
        int quark = ss.getQuarkAbsolute(Attributes.CPUS, Integer.toString(0), Attributes.IRQS, "1");
        long ts1 = ss.getStartTime();
        /* start of the trace */
        long ts2 = startTime + 20L * NANOSECS_PER_SEC;
        /* invalid, but ignored */
        intervals = StateSystemUtils.queryHistoryRange(ss, quark, ts1, ts2);
        /* Activity of IRQ 1 over the whole trace */
        assertEquals(65, intervals.size());
    } catch (AttributeNotFoundException | StateSystemDisposedException e) {
        fail();
    }
}
Also used : StateSystemDisposedException(org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException) AttributeNotFoundException(org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException) ITmfStateInterval(org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test)

Example 5 with ITmfStateSystem

use of org.eclipse.tracecompass.statesystem.core.ITmfStateSystem in project tracecompass by tracecompass.

the class StateSystemTest method testRangeQuery1.

/**
 * Test a range query (with no resolution parameter, so all intervals)
 */
@Test
public void testRangeQuery1() {
    long time1 = interestingTimestamp1;
    long time2 = time1 + 1L * NANOSECS_PER_SEC;
    int quark;
    List<ITmfStateInterval> intervals;
    final ITmfStateSystem ss = fixture;
    assertNotNull(ss);
    try {
        quark = ss.getQuarkAbsolute(Attributes.CPUS, "0", Attributes.CURRENT_THREAD);
        intervals = StateSystemUtils.queryHistoryRange(ss, quark, time1, time2);
        assertEquals(487, intervals.size());
        /* Number of context switches! */
        assertEquals(1685, intervals.get(100).getStateValue().unboxInt());
        assertEquals(1331668248427681372L, intervals.get(205).getEndTime());
    } catch (AttributeNotFoundException | StateSystemDisposedException e) {
        fail();
    }
}
Also used : StateSystemDisposedException(org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException) AttributeNotFoundException(org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException) ITmfStateInterval(org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval) ITmfStateSystem(org.eclipse.tracecompass.statesystem.core.ITmfStateSystem) Test(org.junit.Test)

Aggregations

ITmfStateSystem (org.eclipse.tracecompass.statesystem.core.ITmfStateSystem)137 ITmfStateInterval (org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval)52 Test (org.junit.Test)52 StateSystemDisposedException (org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException)51 NonNull (org.eclipse.jdt.annotation.NonNull)32 AttributeNotFoundException (org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException)30 Nullable (org.eclipse.jdt.annotation.Nullable)26 ArrayList (java.util.ArrayList)25 TmfModelResponse (org.eclipse.tracecompass.tmf.core.response.TmfModelResponse)23 TimeRangeException (org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException)22 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)22 HashMap (java.util.HashMap)18 ITmfStateValue (org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue)16 XmlUtilsTest (org.eclipse.tracecompass.tmf.analysis.xml.core.tests.module.XmlUtilsTest)16 AtomicLong (java.util.concurrent.atomic.AtomicLong)15 DataDrivenAnalysisModule (org.eclipse.tracecompass.internal.tmf.analysis.xml.core.fsm.module.DataDrivenAnalysisModule)10 SelectionTimeQueryFilter (org.eclipse.tracecompass.tmf.core.model.filters.SelectionTimeQueryFilter)10 List (java.util.List)9 QuarkIterator (org.eclipse.tracecompass.statesystem.core.StateSystemUtils.QuarkIterator)9 TmfAnalysisException (org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException)9