use of org.eclipse.tracecompass.statesystem.core.ITmfStateSystem in project tracecompass by tracecompass.
the class XmlProviderTestBase method testStateSystem.
/**
* Test the building of the state system
*/
@Test
public void testStateSystem() {
assertTrue(fModule instanceof ITmfAnalysisModuleWithStateSystems);
assertTrue(((ITmfAnalysisModuleWithStateSystems) fModule).waitForInitialization());
assertTrue(fModule.waitForCompletion(new NullProgressMonitor()));
ITmfStateSystem ss = ((ITmfAnalysisModuleWithStateSystems) fModule).getStateSystem(fModule.getId());
assertNotNull(ss);
List<Integer> quarks = ss.getQuarks("*");
assertFalse(quarks.isEmpty());
}
use of org.eclipse.tracecompass.statesystem.core.ITmfStateSystem in project tracecompass by tracecompass.
the class DataDrivenScenarioInfo method getStateStartTime.
/**
* Get the start time of a state
*
* FIXME: For the first iteration (no data driven patterns yet), this method
* is here, but may move to a class responsible of scenario history, like
* current code
*
* @param container
* The analysis data container
* @param state
* The state for which to get the start time
* @return The start time of the requested state or <code>-1L</code> if this
* state has not been reached
*/
public long getStateStartTime(IAnalysisDataContainer container, String state) {
ITmfStateSystem stateSystem = container.getStateSystem();
int stateQuark = stateSystem.optQuarkRelative(fQuark, TmfXmlStrings.STATE, state, START_TIME);
if (stateQuark < 0) {
return -1L;
}
Object startTs = stateSystem.queryOngoing(stateQuark);
if (startTs instanceof Long) {
return (long) startTs;
}
return -1L;
}
use of org.eclipse.tracecompass.statesystem.core.ITmfStateSystem in project tracecompass by tracecompass.
the class DataDrivenValuePool method resolveValue.
@Override
@Nullable
protected Object resolveValue(ITmfEvent event, int baseQuark, DataDrivenScenarioInfo scenarioInfo, IAnalysisDataContainer container) {
TmfAttributePool pool = container.getAttributePool(baseQuark);
if (pool == null) {
// $NON-NLS-1$
Activator.logWarning("Attribute type pool: No pool was assigned for quark");
return null;
}
int quark = scenarioInfo.getAttributeFromPool(pool);
ITmfStateSystem ss = container.getStateSystem();
return ss.getAttributeName(quark);
}
use of org.eclipse.tracecompass.statesystem.core.ITmfStateSystem in project tracecompass by tracecompass.
the class DataDrivenValueQuery method executeQuery.
@Nullable
private static Object executeQuery(Supplier<Integer> function, IAnalysisDataContainer container) {
/* Query the state system for the value */
Object value = null;
ITmfStateSystem ss = container.getStateSystem();
@SuppressWarnings("null") int quarkQuery = function.get();
/*
* the query can fail : for example, if a value is requested but has not been
* set yet
*/
if (quarkQuery >= 0) {
value = ss.queryOngoing(quarkQuery);
}
return value;
}
use of org.eclipse.tracecompass.statesystem.core.ITmfStateSystem in project tracecompass by tracecompass.
the class DataDrivenValueStackPeek method resolveValue.
@Override
@Nullable
protected Object resolveValue(ITmfEvent event, int baseQuark, DataDrivenScenarioInfo scenarioInfo, IAnalysisDataContainer container) {
final long ts = event.getTimestamp().toNanos();
/* Query the state system for the value */
Object value = null;
ITmfStateSystem ss = container.getStateSystem();
int quarkQuery = fPath.getQuark(event, baseQuark, scenarioInfo, container);
/*
* the query can fail : for example, if a value is requested but has not been
* set yet
*/
if (quarkQuery >= 0) {
try {
@Nullable ITmfStateInterval stackTopInterval = StateSystemUtils.querySingleStackTop(ss, ts, quarkQuery);
return (stackTopInterval != null ? stackTopInterval.getStateValue().unboxValue() : null);
} catch (AttributeNotFoundException | StateSystemDisposedException e) {
// $NON-NLS-1$
throw new DataDrivenException("Resolving stack peek: " + e.getMessage(), event);
}
}
return value;
}
Aggregations