use of org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException in project tracecompass by tracecompass.
the class StateSystemTest method testFullQuery1.
@Test
public void testFullQuery1() {
List<ITmfStateInterval> list;
ITmfStateInterval interval;
int quark, valueInt;
String valueStr;
try {
list = fixture.queryFullState(interestingTimestamp1);
quark = fixture.getQuarkAbsolute(Attributes.CPUS, "0", Attributes.CURRENT_THREAD);
interval = list.get(quark);
valueInt = interval.getStateValue().unboxInt();
assertEquals(1397, valueInt);
quark = fixture.getQuarkAbsolute(Attributes.THREADS, "1432", Attributes.EXEC_NAME);
interval = list.get(quark);
valueStr = interval.getStateValue().unboxStr();
assertEquals("gdbus", valueStr);
quark = fixture.getQuarkAbsolute(Attributes.THREADS, "1432", Attributes.SYSTEM_CALL);
interval = list.get(quark);
valueStr = interval.getStateValue().unboxStr();
assertEquals("poll", valueStr);
} catch (AttributeNotFoundException | StateSystemDisposedException e) {
fail();
}
}
use of org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException in project tracecompass by tracecompass.
the class StateSystemTest method testQueryInvalidValuetype1.
/**
* Query but with the wrong State Value type
*/
@Test(expected = StateValueTypeException.class)
public void testQueryInvalidValuetype1() throws StateValueTypeException {
List<ITmfStateInterval> list;
ITmfStateInterval interval;
int quark;
try {
list = fixture.queryFullState(interestingTimestamp1);
quark = fixture.getQuarkAbsolute(Attributes.CPUS, "0", Attributes.CURRENT_THREAD);
interval = list.get(quark);
/* This is supposed to be an int value */
interval.getStateValue().unboxStr();
} catch (AttributeNotFoundException | StateSystemDisposedException e) {
fail();
}
}
use of org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException 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.exceptions.StateSystemDisposedException 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();
}
}
use of org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException in project tracecompass by tracecompass.
the class StateSystemTest method testRangeQueryInvalidTime2.
@Test(expected = TimeRangeException.class)
public void testRangeQueryInvalidTime2() throws TimeRangeException {
final ITmfStateSystem ss = fixture;
assertNotNull(ss);
try {
int quark = ss.getQuarkAbsolute(Attributes.CPUS, "0", Attributes.CURRENT_THREAD);
long ts1 = startTime - 1L * NANOSECS_PER_SEC;
/* invalid */
long ts2 = startTime + 20L * NANOSECS_PER_SEC;
/* invalid */
StateSystemUtils.queryHistoryRange(ss, quark, ts1, ts2);
} catch (AttributeNotFoundException | StateSystemDisposedException e) {
fail();
}
}
Aggregations