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);
}
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();
}
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();
}
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();
}
}
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();
}
}
Aggregations