}
try {
return ss.querySingleState(ts, prioQuark).getStateValue().unboxInt();
- } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (StateSystemDisposedException e) {
return -1;
}
}
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
int nextTid = ((Long) event.getContent().getField(fNextTid).getValue()).intValue();
final TmfStateValue value = TmfStateValue.newValueInt(nextTid);
ssb.modifyAttribute(event.getTimestamp().toNanos(), value, cpuQuark);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e);
}
}
import org.eclipse.tracecompass.common.core.NonNullUtils;
import org.eclipse.tracecompass.internal.analysis.os.linux.core.Activator;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
if (value.getType().equals(Type.INTEGER)) {
tid = value.unboxInt();
}
- } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (StateSystemDisposedException e) {
Activator.getDefault().logError(NonNullUtils.nullToEmptyString(e.getMessage()), e);
}
return tid;
super.setDiskName(diskname);
try {
fSs.modifyAttribute(fSs.getCurrentEndTime(), TmfStateValue.newValueString(diskname), getQuark());
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.getDefault().logError("Cannot set the diskname for disk " + diskname, e); //$NON-NLS-1$
}
}
int mergedInQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.MERGED_IN);
fSs.modifyAttribute(ts, TmfStateValue.nullValue(), mergedInQuark);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.getDefault().logError("Error inserting request", e); //$NON-NLS-1$
}
fWaitingQueue.put(request.getSector(), new Pair<>(request, slotQuark));
int mergedInQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.MERGED_IN);
fSs.modifyAttribute(ts, TmfStateValue.nullValue(), mergedInQuark);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.getDefault().logError("Error inserting request", e); //$NON-NLS-1$
}
int issuedFromQuark = fSs.getQuarkRelativeAndAdd(slotQuark, Attributes.ISSUED_FROM);
fSs.modifyAttribute(ts, issuedFromValue, issuedFromQuark);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.getDefault().logError("Error issuing request", e); //$NON-NLS-1$
}
int issuedFromQuark = fSs.getQuarkRelativeAndAdd(mergedQuark, Attributes.MERGED_IN);
fSs.modifyAttribute(ts, TmfStateValue.newValueInt(Integer.parseInt(reqQueueId)), issuedFromQuark);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.getDefault().logError("Error adding the merged request information", e); //$NON-NLS-1$
}
}
fSs.modifyAttribute(ts, TmfStateValue.newValueInt(getDriverQueueSize()), fDriverQueueLength);
int fWaitinQueueLength = fSs.getQuarkRelativeAndAdd(getQuark(), Attributes.WAITING_QUEUE_LENGTH);
fSs.modifyAttribute(ts, TmfStateValue.newValueInt(getWaitingQueueSize()), fWaitinQueueLength);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.getDefault().logError("Error updating queues lengths", e); //$NON-NLS-1$
}
}
ppidInterval = ssq.querySingleState(startTime - 1, ppidQuark);
startTime = execNameInterval.getStartTime();
endTime = execNameInterval.getEndTime() + 1;
- } catch (AttributeNotFoundException e) {
- Activator.getDefault().logError(e.getMessage());
} catch (StateSystemDisposedException e) {
/* ignored */
}
long end = Math.min(currentThreadInterval.getEndTime() + 1, ss.getCurrentEndTime());
currentThreadIntervals.add(ss.querySingleState(end, currentThreadQuark));
}
- } catch (AttributeNotFoundException e) {
- Activator.getDefault().logError(e.getMessage());
- return list;
} catch (StateSystemDisposedException e) {
/* Ignored */
return list;
import org.eclipse.tracecompass.analysis.os.linux.core.kernelmemoryusage.KernelMemoryStateProvider;
import org.eclipse.tracecompass.internal.analysis.os.linux.ui.Activator;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
entryList.add(obj);
}
}
- } catch (StateSystemDisposedException | AttributeNotFoundException e) {
+ } catch (StateSystemDisposedException e) {
Activator.getDefault().logError(e.getMessage(), e);
}
return root;
import org.eclipse.tracecompass.lttng2.kernel.core.tests.perf.analysis.kernel.KernelAnalysisBenchmark;
import org.eclipse.tracecompass.lttng2.kernel.core.trace.LttngKernelTrace;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.testtraces.ctf.CtfTestTrace;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.tracecompass.tmf.core.exceptions.TmfTraceException;
/* Get the number of CPUs */
int cpuCount = -1;
- try {
- @NonNull
- List<@NonNull Integer> cpus = ss.getSubAttributes(ITmfStateSystem.ROOT_ATTRIBUTE, false);
- cpuCount = cpus.size();
- } catch (AttributeNotFoundException e) {
- fail(e.getMessage());
- }
+ @NonNull List<@NonNull Integer> cpus = ss.getSubAttributes(ITmfStateSystem.ROOT_ATTRIBUTE, false);
+ cpuCount = cpus.size();
if (cpuCount < 1) {
fail("Impossible to get the number of CPUs");
}
/*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
break;
}
- } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) {
+ } catch (TimeRangeException | StateValueTypeException e) {
Activator.getDefault().logError("Error handling event in VirtualMachineStateProvider", e); //$NON-NLS-1$
}
}
/* Add the entries for the threads */
buildThreadEntries(vmEntry, entryMap, startTime, endTime);
}
- } catch (AttributeNotFoundException e) {
- /*
- * The attribute may not exist yet if the state system is being
- * built
- */
} catch (TimeRangeException | StateValueTypeException e) {
Activator.getDefault().logError("VirtualMachineView: error building event list", e); //$NON-NLS-1$
}
/**********************************************************************
- * Copyright (c) 2014, 2015 Ericsson, École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 Ericsson, École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.tracecompass.lttng2.ust.core.trace.LttngUstTrace;
import org.eclipse.tracecompass.lttng2.ust.core.trace.layout.ILttngUstEventLayout;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
long prevMemValue = prevMem.unboxLong();
prevMemValue += memoryDiff.longValue();
ss.modifyAttribute(ts, TmfStateValue.newValueLong(prevMemValue), tidMemQuark);
- } catch (AttributeNotFoundException | TimeRangeException | StateValueTypeException e) {
+ } catch (TimeRangeException | StateValueTypeException e) {
throw new IllegalStateException(e);
}
}
/*******************************************************************************
- * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
+ * Copyright (c) 2015, 2016 EfficiOS Inc., Alexandre Montplaisir
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
ITmfStateSystem ss = checkNotNull(getStateSystem());
Set<UstDebugInfoBinaryFile> files = new TreeSet<>();
- try {
- ImmutableList.Builder<Integer> builder = ImmutableList.builder();
- List<Integer> vpidQuarks = ss.getSubAttributes(-1, false);
- for (Integer vpidQuark : vpidQuarks) {
- builder.addAll(ss.getSubAttributes(vpidQuark, false));
- }
- List<Integer> baddrQuarks = builder.build();
+ ImmutableList.Builder<Integer> builder = ImmutableList.builder();
+ List<Integer> vpidQuarks = ss.getSubAttributes(-1, false);
+ for (Integer vpidQuark : vpidQuarks) {
+ builder.addAll(ss.getSubAttributes(vpidQuark, false));
+ }
+ List<Integer> baddrQuarks = builder.build();
- /*
- * For each "baddr" attribute, get the "buildId" sub-attribute,
- * whose value is the file path.
- */
+ /*
+ * For each "baddr" attribute, get the "buildId" sub-attribute,
+ * whose value is the file path.
+ */
- for (Integer baddrQuark : baddrQuarks) {
+ for (Integer baddrQuark : baddrQuarks) {
- List<Integer> buildIdQuarks = ss.getSubAttributes(baddrQuark, false);
- for (Integer buildIdQuark : buildIdQuarks) {
- String buildId = ss.getAttributeName(buildIdQuark);
+ List<Integer> buildIdQuarks = ss.getSubAttributes(baddrQuark, false);
+ for (Integer buildIdQuark : buildIdQuarks) {
+ String buildId = ss.getAttributeName(buildIdQuark);
+ /*
+ * Explore the history of this attribute "horizontally",
+ * even though there should only be one valid interval.
+ */
+ ITmfStateInterval interval = StateSystemUtils.queryUntilNonNullValue(ss, buildIdQuark, ss.getStartTime(), Long.MAX_VALUE);
+ if (interval == null) {
/*
- * Explore the history of this attribute "horizontally",
- * even though there should only be one valid interval.
+ * If we created the attribute, we should have assigned
+ * a value to it!
*/
- ITmfStateInterval interval = StateSystemUtils.queryUntilNonNullValue(ss, buildIdQuark, ss.getStartTime(), Long.MAX_VALUE);
- if (interval == null) {
- /*
- * If we created the attribute, we should have assigned
- * a value to it!
- */
- throw new IllegalStateException();
- }
- String filePath = interval.getStateValue().unboxStr();
-
- files.add(new UstDebugInfoBinaryFile(filePath, buildId));
+ throw new IllegalStateException();
}
+ String filePath = interval.getStateValue().unboxStr();
+
+ files.add(new UstDebugInfoBinaryFile(filePath, buildId));
}
- } catch (AttributeNotFoundException e) {
- throw new IllegalStateException(e);
}
return files;
}
/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
+ * Copyright (c) 2012, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
assertEquals(30, interval.getEndTime());
assertTrue(interval.getStateValue().isNull());
- } catch (AttributeNotFoundException | TimeRangeException | StateSystemDisposedException e) {
+ } catch (TimeRangeException | StateSystemDisposedException e) {
fail(errMsg + e.toString());
}
}
/*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
fStateSystem.modifyAttribute(1200L, TmfStateValue.newValueInt(10), quark);
fStateSystem.modifyAttribute(1500L, TmfStateValue.newValueInt(20), quark);
fStateSystem.closeHistory(2000L);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
fail(e.getMessage());
}
}
/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
import org.eclipse.tracecompass.statesystem.core.backend.StateHistoryBackendFactory;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
ITmfStateInterval ref[] = intervalQuery.toArray(new ITmfStateInterval[0]);
assertArrayEquals(ref, interval);
- } catch (TimeRangeException | AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (TimeRangeException | StateSystemDisposedException e) {
fail(e.getMessage());
}
}
ITmfStateInterval interval = backend.doSingularQuery(999, 0);
assertEquals(TmfStateValue.nullValue(), interval.getStateValue());
- } catch (TimeRangeException | AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (TimeRangeException | StateSystemDisposedException e) {
fail(e.getMessage());
}
}
assertEquals(90, interval.getEndTime());
assertEquals(0, interval.getStateValue().unboxInt());
- } catch (TimeRangeException | AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (TimeRangeException | StateSystemDisposedException e) {
fail(e.getMessage());
}
}
ITmfStateInterval interval = backend.doSingularQuery(99998, 9);
testInterval(interval, 99909, 99999, 99);
- } catch (TimeRangeException | AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (TimeRangeException | StateSystemDisposedException e) {
fail(e.getMessage());
}
}
ITmfStateInterval interval = backend.doSingularQuery(-1, 0);
assertNull(interval);
- } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (StateSystemDisposedException e) {
fail(e.getMessage());
}
}
ITmfStateInterval interval = backend.doSingularQuery(100000, 0);
assertNull(interval);
- } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (StateSystemDisposedException e) {
fail(e.getMessage());
}
}
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
interval = backend.doSingularQuery(startTime + (2 * timeStep) + 1, intQuark);
assertEquals("Int interval value", INT_VAL1, interval.getStateValue());
- } catch (TimeRangeException | StateSystemDisposedException | IOException | AttributeNotFoundException e) {
+ } catch (TimeRangeException | StateSystemDisposedException | IOException e) {
fail(e.getMessage());
}
}
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
/**
* The Attribute Tree is the /proc-like filesystem used to organize attributes.
* @return The quark of the specified attribute, or
* {@link ITmfStateSystem#INVALID_ATTRIBUTE} if that attribute does
* not exist.
+ * @throws IndexOutOfBoundsException
+ * If the starting node quark is out of range
*/
public synchronized int getQuarkDontAdd(int startingNodeQuark, String... subPath) {
- assert (startingNodeQuark >= ROOT_ATTRIBUTE);
-
Attribute prevNode;
/* If subPath is empty, simply return the starting quark */
* @param subPath
* The path to the attribute, relative to the starting node.
* @return The quark of the attribute represented by the path
+ * @throws IndexOutOfBoundsException
+ * If the starting node quark is out of range
*/
public synchronized int getQuarkAndAdd(int startingNodeQuark, String... subPath) {
// FIXME synchronized here is probably quite costly... maybe only locking
// the "for" would be enough?
- assert (subPath != null && subPath.length > 0);
- assert (startingNodeQuark >= ROOT_ATTRIBUTE);
Attribute nextNode = null;
Attribute prevNode;
* one level deep will be returned. If true, all descendants will
* be returned (depth-first search)
* @return The list of quarks representing the children attributes
- * @throws AttributeNotFoundException
- * If 'attributeQuark' is invalid, or if there is no attribute
- * associated to it.
+ * @throws IndexOutOfBoundsException
+ * If the attribute quark is out of range
*/
- public synchronized @NonNull List<@NonNull Integer> getSubAttributes(int attributeQuark, boolean recursive)
- throws AttributeNotFoundException {
+ public synchronized @NonNull List<@NonNull Integer> getSubAttributes(int attributeQuark, boolean recursive) {
List<@NonNull Integer> listOfChildren = new ArrayList<>();
Attribute startingAttribute;
- /* Check if the quark is valid */
- if (attributeQuark < ROOT_ATTRIBUTE || attributeQuark >= attributeList.size()) {
- throw new AttributeNotFoundException(ss.getSSID() + " Quark:" + attributeQuark); //$NON-NLS-1$
- }
-
/* Set up the node from which we'll start the search */
if (attributeQuark == ROOT_ATTRIBUTE) {
startingAttribute = attributeTreeRoot;
* The quark of the attribute
* @return Quark of the parent attribute or
* {@link ITmfStateSystem#ROOT_ATTRIBUTE} for the root attribute
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
public synchronized int getParentAttributeQuark(int quark) {
if (quark == ROOT_ATTRIBUTE) {
* @param quark
* The quark of the attribute
* @return The (base) name of the attribute
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
public synchronized @NonNull String getAttributeName(int quark) {
return attributeList.get(quark).getName();
* @param quark
* The quark of the attribute
* @return The full path name of the attribute
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
public synchronized @NonNull String getFullAttributeName(int quark) {
return attributeList.get(quark).getFullAttributeName();
* @param quark
* The quark of the attribute
* @return The path elements of the full path
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
public synchronized String @NonNull [] getFullAttributePathArray(int quark) {
return attributeList.get(quark).getFullAttribute();
}
@Override
- public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive)
- throws AttributeNotFoundException {
+ public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive) {
return getAttributeTree().getSubAttributes(quark, recursive);
}
@Override
- public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern)
- throws AttributeNotFoundException {
+ public List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern) {
List<Integer> all = getSubAttributes(quark, recursive);
List<@NonNull Integer> ret = new LinkedList<>();
for (Integer attQuark : all) {
}
private void getQuarks(Builder<@NonNull Integer> builder, int quark, List<String> pattern) {
- try {
- String element = pattern.get(0);
- if (element == null) {
- return;
+ String element = pattern.get(0);
+ if (element == null) {
+ return;
+ }
+ List<String> remainder = pattern.subList(1, pattern.size());
+ if (remainder.isEmpty()) {
+ if (element.equals(WILDCARD)) {
+ builder.addAll(getSubAttributes(quark, false));
+ } else if (element.equals(PARENT)){
+ builder.add(getParentAttributeQuark(quark));
+ } else {
+ int subQuark = optQuarkRelative(quark, element);
+ if (subQuark != INVALID_ATTRIBUTE) {
+ builder.add(subQuark);
+ }
}
- List<String> remainder = pattern.subList(1, pattern.size());
- if (remainder.isEmpty()) {
- if (element.equals(WILDCARD)) {
- builder.addAll(getSubAttributes(quark, false));
- } else if (element.equals(PARENT)){
- builder.add(getParentAttributeQuark(quark));
- } else {
- int subQuark = optQuarkRelative(quark, element);
- if (subQuark != INVALID_ATTRIBUTE) {
- builder.add(subQuark);
- }
+ } else {
+ if (element.equals(WILDCARD)) {
+ for (@NonNull Integer subquark : getSubAttributes(quark, false)) {
+ getQuarks(builder, subquark, remainder);
}
+ } else if (element.equals(PARENT)){
+ getQuarks(builder, getParentAttributeQuark(quark), remainder);
} else {
- if (element.equals(WILDCARD)) {
- for (@NonNull Integer subquark : getSubAttributes(quark, false)) {
- getQuarks(builder, subquark, remainder);
- }
- } else if (element.equals(PARENT)){
- getQuarks(builder, getParentAttributeQuark(quark), remainder);
- } else {
- int subQuark = optQuarkRelative(quark, element);
- if (subQuark != INVALID_ATTRIBUTE) {
- getQuarks(builder, subQuark, remainder);
- }
+ int subQuark = optQuarkRelative(quark, element);
+ if (subQuark != INVALID_ATTRIBUTE) {
+ getQuarks(builder, subQuark, remainder);
}
}
- } catch (AttributeNotFoundException e) {
- /* The starting node quark is out of range */
- throw new IndexOutOfBoundsException(String.format("Index: %d, Size: %d", quark, getNbAttributes())); //$NON-NLS-1$
}
}
@Override
public void modifyAttribute(long t, ITmfStateValue value, int attributeQuark)
- throws TimeRangeException, AttributeNotFoundException,
- StateValueTypeException {
+ throws TimeRangeException, StateValueTypeException {
if (value == null) {
/*
* TODO Replace with @NonNull parameter (will require fixing all the
@Deprecated
@Override
public void incrementAttribute(long t, int attributeQuark)
- throws StateValueTypeException, TimeRangeException,
- AttributeNotFoundException {
+ throws StateValueTypeException, TimeRangeException {
ITmfStateValue stateValue = queryOngoingState(attributeQuark);
int prevValue = 0;
/* if the attribute was previously null, start counting at 0 */
@Override
public void pushAttribute(long t, ITmfStateValue value, int attributeQuark)
- throws TimeRangeException, AttributeNotFoundException,
- StateValueTypeException {
+ throws TimeRangeException, StateValueTypeException {
int stackDepth;
int subAttributeQuark;
ITmfStateValue previousSV = transState.getOngoingStateValue(attributeQuark);
* out of control due to buggy insertions
*/
String message = " Stack limit reached, not pushing"; //$NON-NLS-1$
- throw new AttributeNotFoundException(getSSID() + " Quark:" + attributeQuark + message); //$NON-NLS-1$
+ throw new IllegalStateException(getSSID() + " Quark:" + attributeQuark + message); //$NON-NLS-1$
}
stackDepth++;
@Override
public ITmfStateValue popAttribute(long t, int attributeQuark)
- throws AttributeNotFoundException, TimeRangeException,
- StateValueTypeException {
+ throws TimeRangeException, StateValueTypeException {
/* These are the state values of the stack-attribute itself */
ITmfStateValue previousSV = transState.getOngoingStateValue(attributeQuark);
}
/* The attribute should already exist at this point */
- int subAttributeQuark = getQuarkRelative(attributeQuark, String.valueOf(stackDepth));
+ int subAttributeQuark;
+ try {
+ subAttributeQuark = getQuarkRelative(attributeQuark, String.valueOf(stackDepth));
+ } catch (AttributeNotFoundException e) {
+ String message = " Stack attribute missing sub-attribute for depth:" + stackDepth; //$NON-NLS-1$
+ throw new IllegalStateException(getSSID() + " Quark:" + attributeQuark + message); //$NON-NLS-1$
+ }
ITmfStateValue poppedValue = queryOngoingState(subAttributeQuark);
/* Update the state value of the stack-attribute */
@Override
public void removeAttribute(long t, int attributeQuark)
- throws TimeRangeException, AttributeNotFoundException {
- if (attributeQuark < 0) {
- throw new IllegalArgumentException();
- }
-
+ throws TimeRangeException {
/*
* Nullify our children first, recursively. We pass 'false' because we
* handle the recursion ourselves.
//--------------------------------------------------------------------------
@Override
- public ITmfStateValue queryOngoingState(int attributeQuark)
- throws AttributeNotFoundException {
+ public ITmfStateValue queryOngoingState(int attributeQuark) {
return transState.getOngoingStateValue(attributeQuark);
}
@Override
- public long getOngoingStartTime(int attribute)
- throws AttributeNotFoundException {
+ public long getOngoingStartTime(int attribute) {
return transState.getOngoingStartTime(attribute);
}
@Override
- public void updateOngoingState(ITmfStateValue newValue, int attributeQuark)
- throws AttributeNotFoundException {
+ public void updateOngoingState(ITmfStateValue newValue, int attributeQuark) {
transState.changeOngoingStateValue(attributeQuark, newValue);
}
@Override
public ITmfStateInterval querySingleState(long t, int attributeQuark)
- throws AttributeNotFoundException, TimeRangeException,
- StateSystemDisposedException {
+ throws TimeRangeException, StateSystemDisposedException {
if (isDisposed) {
throw new StateSystemDisposedException();
}
/*******************************************************************************
- * Copyright (c) 2012, 2015 Ericsson
+ * Copyright (c) 2012, 2016 Ericsson
* Copyright (c) 2010, 2011 École Polytechnique de Montréal
* Copyright (c) 2010, 2011 Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
*
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
* @param quark
* The quark of the attribute to look for
* @return The corresponding state value
- * @throws AttributeNotFoundException
- * If the quark is invalid
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
- public ITmfStateValue getOngoingStateValue(int quark) throws AttributeNotFoundException {
+ public ITmfStateValue getOngoingStateValue(int quark) {
fRWLock.readLock().lock();
try {
- checkValidAttribute(quark);
return fOngoingStateInfo.get(quark);
} finally {
fRWLock.readLock().unlock();
* @param quark
* The quark of the attribute to look for
* @return The start time of the current state for this attribute
- * @throws AttributeNotFoundException
- * If the quark is invalid
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
- public long getOngoingStartTime(int quark) throws AttributeNotFoundException {
+ public long getOngoingStartTime(int quark) {
fRWLock.readLock().lock();
try {
- checkValidAttribute(quark);
return fOngoingStateStartTimes.get(quark);
} finally {
fRWLock.readLock().unlock();
* The quark of the attribute to modify
* @param newValue
* The state value the attribute should have
- * @throws AttributeNotFoundException
- * If the quark is invalid
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
- public void changeOngoingStateValue(int quark, ITmfStateValue newValue)
- throws AttributeNotFoundException {
+ public void changeOngoingStateValue(int quark, ITmfStateValue newValue) {
fRWLock.writeLock().lock();
try {
- checkValidAttribute(quark);
fOngoingStateInfo.set(quark, newValue);
} finally {
fRWLock.writeLock().unlock();
* The quark of the attribute
* @return An interval representing the current state (but whose end time is
* the current one, and probably not the "final" one)
- * @throws AttributeNotFoundException
- * If the quark is invalid
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
- public ITmfStateInterval getOngoingInterval(int quark) throws AttributeNotFoundException {
+ public ITmfStateInterval getOngoingInterval(int quark) {
fRWLock.readLock().lock();
try {
- checkValidAttribute(quark);
return new TmfStateInterval(fOngoingStateStartTimes.get(quark), fLatestTime,
quark, fOngoingStateInfo.get(quark));
} finally {
* The quark of the attribute to look for
* @return The corresponding TmfStateInterval object if we could find it in
* this transient state, or null if we couldn't.
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
public @Nullable ITmfStateInterval getIntervalAt(long time, int quark) {
fRWLock.readLock().lock();
try {
- checkValidAttribute(quark);
if (!isActive() || time < fOngoingStateStartTimes.get(quark)) {
return null;
}
return new TmfStateInterval(fOngoingStateStartTimes.get(quark),
fLatestTime, quark, fOngoingStateInfo.get(quark));
- } catch (AttributeNotFoundException e) {
- return null;
} finally {
fRWLock.readLock().unlock();
}
}
- private void checkValidAttribute(int quark) throws AttributeNotFoundException {
- if (quark > fOngoingStateInfo.size() - 1 || quark < 0) {
- throw new AttributeNotFoundException(fBackend.getSSID() + " Quark:" + quark); //$NON-NLS-1$
- }
- }
-
/**
* More advanced version of {@link #changeOngoingStateValue}. Replaces the
* complete ongoingStateInfo in one go, and updates the
* The quark of the attribute that is being modified
* @throws TimeRangeException
* If 'eventTime' is invalid
- * @throws AttributeNotFoundException
- * IF 'quark' does not represent an existing attribute
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
* @throws StateValueTypeException
* If the state value to be inserted is of a different type of
* what was inserted so far for this attribute.
*/
public void processStateChange(long eventTime, ITmfStateValue value, int quark)
- throws TimeRangeException, AttributeNotFoundException, StateValueTypeException {
+ throws TimeRangeException, StateValueTypeException {
if (!this.fIsActive) {
return;
}
fRWLock.writeLock().lock();
try {
Type expectedSvType = fStateValueTypes.get(quark);
- checkValidAttribute(quark);
/*
* Make sure the state value type we're inserting is the same as the
/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
import org.eclipse.tracecompass.statesystem.core.interval.TmfStateInterval;
@Override
public ITmfStateInterval doSingularQuery(long t, int attributeQuark)
- throws TimeRangeException, AttributeNotFoundException {
+ throws TimeRangeException {
if (!checkValidTime(t)) {
throw new TimeRangeException(ssid + " Time:" + t + ", Start:" + startTime + ", End:" + latestTime); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
}
}
- throw new AttributeNotFoundException(ssid + " Quark:" + attributeQuark); //$NON-NLS-1$
+ return null;
}
private boolean checkValidTime(long t) {
* True if you want all recursive sub-attributes, false if you
* only want the first level.
* @return A List of integers, matching the quarks of the sub-attributes.
- * @throws AttributeNotFoundException
- * If the quark was not existing or invalid.
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
- @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive)
- throws AttributeNotFoundException;
+ @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive);
/**
* Return the sub-attributes of the target attribute, as a List of quarks,
* @return A List of integers, matching the quarks of the sub-attributes
* that match the regex. An empty list is returned if there is no
* matching attribute.
- * @throws AttributeNotFoundException
- * If the 'quark' was not existing or invalid.
+ * @throws IndexOutOfBoundsException
+ * If the quark is out of range
*/
- @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern)
- throws AttributeNotFoundException;
+ @NonNull List<@NonNull Integer> getSubAttributes(int quark, boolean recursive, String pattern);
/**
* Batch quark-retrieving method. This method allows you to specify a path
* @param attributeQuark
* For which attribute we want the current state
* @return The State value that's "current" for this attribute
- * @throws AttributeNotFoundException
- * If the requested attribute is invalid
+ * @throws IndexOutOfBoundsException
+ * If the attribute quark is out of range
*/
- @NonNull ITmfStateValue queryOngoingState(int attributeQuark)
- throws AttributeNotFoundException;
+ @NonNull ITmfStateValue queryOngoingState(int attributeQuark);
/**
* Get the start time of the current ongoing state, for the specified
* attribute.
*
- * @param attribute
+ * @param attributeQuark
* Quark of the attribute
* @return The current start time of the ongoing state
- * @throws AttributeNotFoundException
- * If the attribute is invalid
+ * @throws IndexOutOfBoundsException
+ * If the attribute quark is out of range
*/
- long getOngoingStartTime(int attribute)
- throws AttributeNotFoundException;
+ long getOngoingStartTime(int attributeQuark);
/**
* Load the complete state information at time 't' into the returned List.
* @return The StateInterval representing the state
* @throws TimeRangeException
* If 't' is invalid
- * @throws AttributeNotFoundException
- * If the requested quark does not exist in the model
+ * @throws IndexOutOfBoundsException
+ * If the attribute quark is out of range
* @throws StateSystemDisposedException
* If the query is sent after the state system has been disposed
*/
@NonNull ITmfStateInterval querySingleState(long t, int attributeQuark)
- throws AttributeNotFoundException, StateSystemDisposedException;
+ throws StateSystemDisposedException;
}
\ No newline at end of file
/*******************************************************************************
- * Copyright (c) 2012, 2014 Ericsson
+ * Copyright (c) 2012, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
package org.eclipse.tracecompass.statesystem.core;
import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
* @param subPath
* "Rest" of the path to get to the final attribute
* @return The matching quark, either if it's new of just got created.
+ * @throws IndexOutOfBoundsException
+ * If the starting node quark is out of range
*/
int getQuarkRelativeAndAdd(int startingNodeQuark, String... subPath);
* The new value that will overwrite the "current" one.
* @param attributeQuark
* For which attribute in the system
- * @throws AttributeNotFoundException
- * If the requested attribute is invalid
+ * @throws IndexOutOfBoundsException
+ * If the attribute quark is out of range
*/
- void updateOngoingState(@NonNull ITmfStateValue newValue, int attributeQuark)
- throws AttributeNotFoundException;
+ void updateOngoingState(@NonNull ITmfStateValue newValue, int attributeQuark);
/**
* Basic attribute modification method, we simply specify a new value, for a
* want to modify
* @throws TimeRangeException
* If the requested time is outside of the trace's range
- * @throws AttributeNotFoundException
- * If the requested attribute quark is invalid
+ * @throws IndexOutOfBoundsException
+ * If the attribute quark is out of range
* @throws StateValueTypeException
* If the inserted state value's type does not match what is
* already assigned to this attribute.
*/
void modifyAttribute(long t, ITmfStateValue value, int attributeQuark)
- throws AttributeNotFoundException, StateValueTypeException;
+ throws StateValueTypeException;
/**
* Increment attribute method. Reads the current value of a given integer
* If the attribute already exists but is not of type Integer
* @throws TimeRangeException
* If the given timestamp is invalid
- * @throws AttributeNotFoundException
- * If the quark is invalid
+ * @throws IndexOutOfBoundsException
+ * If the attribute quark is out of range
* @deprecated Use
* {@link StateSystemBuilderUtils#incrementAttributeInt(ITmfStateSystemBuilder, long, int, int)}
* instead
*/
@Deprecated
void incrementAttribute(long t, int attributeQuark)
- throws AttributeNotFoundException, StateValueTypeException;
+ throws StateValueTypeException;
/**
* "Push" helper method. This uses the given integer attribute as a stack:
* will be created (with depth = 1)
* @throws TimeRangeException
* If the requested timestamp is invalid
- * @throws AttributeNotFoundException
- * If the attribute is invalid
+ * @throws IndexOutOfBoundsException
+ * If the attribute quark is out of range
* @throws StateValueTypeException
* If the attribute 'attributeQuark' already exists, but is not
* of integer type.
*/
void pushAttribute(long t, ITmfStateValue value, int attributeQuark)
- throws AttributeNotFoundException, StateValueTypeException;
+ throws StateValueTypeException;
/**
* Antagonist of the pushAttribute(), pops the top-most attribute on the
* Quark of the stack-attribute to pop
* @return The state value that was popped, or 'null' if nothing was
* actually removed from the stack.
- * @throws AttributeNotFoundException
- * If the attribute is invalid
+ * @throws IndexOutOfBoundsException
+ * If the attribute quark is out of range
* @throws TimeRangeException
* If the timestamp is invalid
* @throws StateValueTypeException
* type is invalid (not an integer)
*/
ITmfStateValue popAttribute(long t, int attributeQuark)
- throws AttributeNotFoundException, StateValueTypeException;
+ throws StateValueTypeException;
/**
* Remove attribute method. Similar to the above modify- methods, with value
* Attribute to remove
* @throws TimeRangeException
* If the timestamp is invalid
- * @throws AttributeNotFoundException
- * If the quark is invalid
+ * @throws IndexOutOfBoundsException
+ * If the attribute quark is out of range
*/
- void removeAttribute(long t, int attributeQuark)
- throws AttributeNotFoundException;
+ void removeAttribute(long t, int attributeQuark);
/**
* Method to close off the History Provider. This happens for example when
/*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
}
current = currentInterval.getEndTime() + 1;
}
- } catch (AttributeNotFoundException | StateSystemDisposedException | TimeRangeException e) {
+ } catch (StateSystemDisposedException | TimeRangeException e) {
/* Nothing to do */
}
return null;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
* The target timestamp of the query.
* @param attributeQuark
* The single attribute for which you want the state interval
- * @return The state interval matching this timestamp/attribute pair
+ * @return The state interval matching this timestamp/attribute pair, or
+ * null if it was not found
* @throws TimeRangeException
* If the timestamp was invalid
- * @throws AttributeNotFoundException
- * If the quark was invalid
* @throws StateSystemDisposedException
* If the state system is disposed while a request is ongoing.
*/
ITmfStateInterval doSingularQuery(long t, int attributeQuark)
- throws TimeRangeException, AttributeNotFoundException,
- StateSystemDisposedException;
+ throws TimeRangeException, StateSystemDisposedException;
/**
* Debug method to print the contents of the history backend.
import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.module.IXmlStateSystemContainer;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.stateprovider.TmfXmlStrings;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
int attributeQuark = getQuarkRelativeAndAdd(ss, info.getQuark(), START_TIME);
ITmfStateInterval state = ss.querySingleState(ts, attributeQuark);
return state.getStartTime();
- } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (StateSystemDisposedException e) {
Activator.logError("failed to get the start time of the scenario", e); //$NON-NLS-1$
}
return -1L;
try {
int attributeQuark = getQuarkRelativeAndAdd(ss, info.getQuark(), TmfXmlStrings.STORED_FIELDS, attributeName);
ss.modifyAttribute(ts, value, attributeQuark);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.logError("failed to save the stored field " + attributeName, e); //$NON-NLS-1$
}
}
try {
int attributeQuark = getQuarkRelativeAndAdd(ss, info.getQuark(), TmfXmlStrings.STORED_FIELDS, attributeName);
ss.modifyAttribute(ts, value, attributeQuark);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.logError("failed to clear the stored fields", e); //$NON-NLS-1$
}
}
try {
int attributeQuark = getQuarkRelativeAndAdd(ss, info.getQuark(), TmfXmlStrings.STORED_FIELDS, attributeName);
state = ss.querySingleState(ts, attributeQuark);
- } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (StateSystemDisposedException e) {
Activator.logError("failed to get the value of the stored field " + attributeName, e); //$NON-NLS-1$
}
return (state != null) ? NonNullUtils.checkNotNull(state.getStateValue()) : TmfStateValue.nullValue();
int attributeQuark = getQuarkRelativeAndAdd(ss, info.getQuark(), TmfXmlStrings.STATE, stateName, START_TIME);
ITmfStateInterval state = ss.querySingleState(ts, attributeQuark);
return state.getStartTime();
- } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (StateSystemDisposedException e) {
Activator.logError("failed the start time of the state " + stateName, e); //$NON-NLS-1$
}
return -1l;
break;
}
ss.modifyAttribute(ts, value, info.getStatusQuark());
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.logError("failed to update scenario status"); //$NON-NLS-1$
}
}
ITmfStateValue value = TmfStateValue.newValueString(info.getActiveState());
int attributeQuark = ss.getQuarkRelativeAndAdd(info.getQuark(), TmfXmlStrings.STATE);
ss.modifyAttribute(ts, value, attributeQuark);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.logError("failed to update scenario state"); //$NON-NLS-1$
}
}
ITmfStateValue value = TmfStateValue.newValueLong(ts);
ss.modifyAttribute(ts, value, attributeQuark);
}
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.logError("failed to update the start time of the state"); //$NON-NLS-1$
}
}
ITmfStateValue value = TmfStateValue.newValueLong(ts);
int attributeQuark = ss.getQuarkRelativeAndAdd(info.getQuark(), START_TIME);
ss.modifyAttribute(ts, value, attributeQuark);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
Activator.logError("failed to update the start time of the scenario"); //$NON-NLS-1$
}
}
int i = 0;
List<Integer> quarks = Collections.singletonList(baseQuark);
- try {
- while (i < paths.length) {
- List<Integer> subQuarks = new LinkedList<>();
- /* Replace * by .* to have a regex string */
- String name = paths[i].replaceAll("\\*", ".*"); //$NON-NLS-1$ //$NON-NLS-2$
- for (int relativeQuark : quarks) {
- for (int quark : ss.getSubAttributes(relativeQuark, false, name)) {
- subQuarks.add(quark);
- }
+ while (i < paths.length) {
+ List<Integer> subQuarks = new LinkedList<>();
+ /* Replace * by .* to have a regex string */
+ String name = paths[i].replaceAll("\\*", ".*"); //$NON-NLS-1$ //$NON-NLS-2$
+ for (int relativeQuark : quarks) {
+ for (int quark : ss.getSubAttributes(relativeQuark, false, name)) {
+ subQuarks.add(quark);
}
- quarks = subQuarks;
- i++;
}
+ quarks = subQuarks;
+ i++;
+ }
- /* Process each quark */
- XmlEntry currentEntry = parentEntry;
- Element displayElement = null;
- Map<String, XmlEntry> entryMap = new HashMap<>();
- if (!displayElements.isEmpty()) {
- displayElement = displayElements.get(0);
- }
- for (int quark : quarks) {
- currentEntry = parentEntry;
- /* Process the current entry, if specified */
- if (displayElement != null) {
- currentEntry = processEntry(entryElement, displayElement, parentEntry, quark, ss);
- entryMap.put(currentEntry.getId(), currentEntry);
- }
- /* Process the children entry of this entry */
- for (Element subEntryEl : entryElements) {
- buildEntry(subEntryEl, currentEntry, quark);
- }
+ /* Process each quark */
+ XmlEntry currentEntry = parentEntry;
+ Element displayElement = null;
+ Map<String, XmlEntry> entryMap = new HashMap<>();
+ if (!displayElements.isEmpty()) {
+ displayElement = displayElements.get(0);
+ }
+ for (int quark : quarks) {
+ currentEntry = parentEntry;
+ /* Process the current entry, if specified */
+ if (displayElement != null) {
+ currentEntry = processEntry(entryElement, displayElement, parentEntry, quark, ss);
+ entryMap.put(currentEntry.getId(), currentEntry);
}
- if (!entryMap.isEmpty()) {
- buildTree(entryMap, parentEntry);
+ /* Process the children entry of this entry */
+ for (Element subEntryEl : entryElements) {
+ buildEntry(subEntryEl, currentEntry, quark);
}
- } catch (AttributeNotFoundException e) {
+ }
+ if (!entryMap.isEmpty()) {
+ buildTree(entryMap, parentEntry);
}
}
}
entryEnd = oneInterval.getEndTime();
- } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (StateSystemDisposedException e) {
}
return new XmlEntry(quark, displayQuark, parentEntry.getTrace(), ss.getAttributeName(quark),
/*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal and others.
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal and others.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.XmlViewInfo;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
String[] paths = fPath.split(SPLIT_STRING);
List<Integer> quarks = Collections.singletonList(IXmlStateSystemContainer.ROOT_QUARK);
- try {
- for (String path : paths) {
- List<Integer> subQuarks = new LinkedList<>();
- /* Replace * by .* to have a regex string */
- String name = WILDCARD_PATTERN.matcher(path).replaceAll(".*"); //$NON-NLS-1$
- for (int relativeQuark : quarks) {
- subQuarks.addAll(fStateSystem.getSubAttributes(relativeQuark, false, name));
- }
- quarks = subQuarks;
+ for (String path : paths) {
+ List<Integer> subQuarks = new LinkedList<>();
+ /* Replace * by .* to have a regex string */
+ String name = WILDCARD_PATTERN.matcher(path).replaceAll(".*"); //$NON-NLS-1$
+ for (int relativeQuark : quarks) {
+ subQuarks.addAll(fStateSystem.getSubAttributes(relativeQuark, false, name));
}
- } catch (AttributeNotFoundException e) {
- /*
- * We get all attributes from the state system itself, this
- * should not happen.
- */
- throw new IllegalStateException();
+ quarks = subQuarks;
}
return quarks;
}
setSeries(data.getSeriesName(), data.getYValues());
}
updateDisplay();
- } catch (AttributeNotFoundException | StateValueTypeException e) {
+ } catch (StateValueTypeException e) {
Activator.logError("Error updating the data of XML XY view", e); //$NON-NLS-1$
} catch (StateSystemDisposedException e) {
return;
import org.eclipse.tracecompass.statesystem.core.StateSystemFactory;
import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
import org.eclipse.tracecompass.statesystem.core.backend.StateHistoryBackendFactory;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
assertEquals("1", fStateSystem.getAttributeName(available2));
/* Modify them */
- try {
- fStateSystem.modifyAttribute(START_TIME + 10, VALUE, available);
- fStateSystem.modifyAttribute(START_TIME + 10, VALUE, available2);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
- fail(e.getMessage());
- }
+ fStateSystem.modifyAttribute(START_TIME + 10, VALUE, available);
+ fStateSystem.modifyAttribute(START_TIME + 10, VALUE, available2);
/* Recycle one and make sure it is set to null */
pool.recycle(available, START_TIME + 20);
- try {
- ITmfStateValue value = fStateSystem.queryOngoingState(available);
- assertEquals(TmfStateValue.nullValue(), value);
- } catch (AttributeNotFoundException e) {
- fail(e.getMessage());
- }
+ ITmfStateValue value = fStateSystem.queryOngoingState(available);
+ assertEquals(TmfStateValue.nullValue(), value);
/* Get a new one and make sure it is reusing the one just recycled */
Integer available3 = pool.getAvailable();
assertEquals(TmfStateValue.nullValue(), value);
value = fStateSystem.queryOngoingState(child2);
assertEquals(TmfStateValue.nullValue(), value);
- } catch (StateValueTypeException | AttributeNotFoundException e) {
+ } catch (StateValueTypeException e) {
fail(e.getMessage());
}
}
/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.tracecompass.internal.tmf.core.Activator;
import org.eclipse.tracecompass.internal.tmf.core.statesystem.mipmap.AbstractTmfMipmapStateProvider;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
private ITmfStateValue.Type type;
private static final @NonNull String MIPMAP_ID = "MIPMAP_ID"; //$NON-NLS-1$
- private final String ERROR_ATTRIBUTE_NOT_FOUND = "Error : Impossible to find the attribute"; //$NON-NLS-1$
private final String ERROR_INVALID_STATE_VALUE = "Error : Invalid state value"; //$NON-NLS-1$
private final String ERROR_INVALID_TIMESTAMP = "Error : Invalid timestamp"; //$NON-NLS-1$
modifyMipmapAttribute(ts, value, quark, MIN | MAX | AVG, resolution);
} catch (TimeRangeException e) {
Activator.logError(ERROR_INVALID_TIMESTAMP, e);
- } catch (AttributeNotFoundException e) {
- Activator.logError(ERROR_ATTRIBUTE_NOT_FOUND, e);
} catch (StateValueTypeException e) {
Activator.logError(ERROR_INVALID_STATE_VALUE, e);
}
/*******************************************************************************
- * Copyright (c) 2014, 2015 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
int quarkId = ss.getQuarkAbsoluteAndAdd(TRACE_QUARK_NAME);
ss.modifyAttribute(event.getTimestamp().getValue(), TmfStateValue.newValueInt(++fCount), quarkId);
fTraces.add(event.getTrace());
- } catch (TimeRangeException | AttributeNotFoundException | StateValueTypeException e) {
+ } catch (TimeRangeException | StateValueTypeException e) {
}
}
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
int quarkId = ss.getQuarkAbsoluteAndAdd("String");
int quark = ss.getQuarkRelativeAndAdd(quarkId, fString);
ss.modifyAttribute(event.getTimestamp().getValue(), TmfStateValue.newValueInt(fCount++), quark);
- } catch (TimeRangeException | AttributeNotFoundException | StateValueTypeException e) {
+ } catch (TimeRangeException | StateValueTypeException e) {
}
}
sfHandler.eventHandle(ss, event);
}
-
-
@Override
public void processEvent(@NonNull ITmfEvent event) {
fLock.lock();
/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.statesystem.core.backend.IStateHistoryBackend;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
* looking for. However, the method expects a List of *state intervals*,
* not state values, so we'll create intervals with a dummy end time.
*/
- try {
- for (int i = 0; i < currentStateInfo.size(); i++) {
- long start = 0;
- start = ((ITmfStateSystem) fPartialSS).getOngoingStartTime(i);
- ITmfStateValue val = ((ITmfStateSystem) fPartialSS).queryOngoingState(i);
+ for (int i = 0; i < currentStateInfo.size(); i++) {
+ long start = 0;
+ start = ((ITmfStateSystem) fPartialSS).getOngoingStartTime(i);
+ ITmfStateValue val = ((ITmfStateSystem) fPartialSS).queryOngoingState(i);
- ITmfStateInterval interval = new TmfStateInterval(start, t, i, checkNotNull(val));
- currentStateInfo.set(i, interval);
- }
- } catch (AttributeNotFoundException e) {
- /* Should not happen, we iterate over existing values. */
- e.printStackTrace();
+ ITmfStateInterval interval = new TmfStateInterval(start, t, i, checkNotNull(val));
+ currentStateInfo.set(i, interval);
}
fPartialSS.releaseQueryLock();
/*******************************************************************************
- * Copyright (c) 2013, 2015 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.tmf.core.Activator;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
* The mipmap resolution (must be greater than 1)
* @throws TimeRangeException
* If the requested time is outside of the trace's range
- * @throws AttributeNotFoundException
- * If the requested attribute quark is invalid
* @throws StateValueTypeException
* If the inserted state value's type does not match what is
* already assigned to this attribute.
* @see #AVG
*/
public void modifyMipmapAttribute(long ts, ITmfStateValue value, int baseQuark, int mipmapFeatureBits, int resolution)
- throws TimeRangeException, AttributeNotFoundException, StateValueTypeException {
+ throws TimeRangeException, StateValueTypeException {
ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder());
ss.modifyAttribute(ts, value, baseQuark);
if (value.getType() == Type.LONG || value.getType() == Type.INTEGER || value.getType() == Type.DOUBLE || value.isNull()) {
}
} catch (TimeRangeException e) {
Activator.logError("MipMapProvider : Time stamp outside of time range of state system", e); //$NON-NLS-1$
- } catch (AttributeNotFoundException e) {
- Activator.logError("MipMapProvider : Attribute not found", e); //$NON-NLS-1$
} catch (StateValueTypeException e) {
Activator.logError("MipMapProvider : Wrong state value type", e); //$NON-NLS-1$
}
/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.tracecompass.internal.tmf.core.Activator;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateValueTypeException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
ss.modifyAttribute(startTime, value, levelQuark);
} catch (StateValueTypeException e) {
Activator.logError("TmfMipmapFeature : Bad state value type", e); //$NON-NLS-1$
- } catch (AttributeNotFoundException e) {
- Activator.logError("TmfMipmapFeature : Attribute not found", e); //$NON-NLS-1$
} catch (TimeRangeException e) {
Activator.logError("TmfMipmapFeature : Time stamp is out of range", e); //$NON-NLS-1$
}
import org.eclipse.osgi.util.NLS;
import org.eclipse.tracecompass.internal.tmf.core.Activator;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder());
- try {
- /* Check if the event is a function entry */
- ITmfStateValue functionEntryName = functionEntry(event);
- if (functionEntryName != null) {
- long timestamp = event.getTimestamp().toNanos();
+ /* Check if the event is a function entry */
+ ITmfStateValue functionEntryName = functionEntry(event);
+ if (functionEntryName != null) {
+ long timestamp = event.getTimestamp().toNanos();
- String processName = getProcessName(event);
- int processId = getProcessId(event);
- if (processName == null) {
- processName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId);
- }
- int processQuark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName);
- ss.updateOngoingState(TmfStateValue.newValueInt(processId), processQuark);
-
- String threadName = getThreadName(event);
- long threadId = getThreadId(event);
- if (threadName == null) {
- threadName = Long.toString(threadId);
- }
- int threadQuark = ss.getQuarkRelativeAndAdd(processQuark, threadName);
- ss.updateOngoingState(TmfStateValue.newValueLong(threadId), threadQuark);
-
- int callStackQuark = ss.getQuarkRelativeAndAdd(threadQuark, CALL_STACK);
- ITmfStateValue value = functionEntryName;
- ss.pushAttribute(timestamp, value, callStackQuark);
- return;
+ String processName = getProcessName(event);
+ int processId = getProcessId(event);
+ if (processName == null) {
+ processName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId);
}
+ int processQuark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName);
+ ss.updateOngoingState(TmfStateValue.newValueInt(processId), processQuark);
- /* Check if the event is a function exit */
- ITmfStateValue functionExitState = functionExit(event);
- if (functionExitState != null) {
- long timestamp = event.getTimestamp().toNanos();
- String processName = getProcessName(event);
- if (processName == null) {
- int processId = getProcessId(event);
- processName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId);
- }
- String threadName = getThreadName(event);
- if (threadName == null) {
- threadName = Long.toString(getThreadId(event));
- }
- int quark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName, threadName, CALL_STACK);
- ITmfStateValue poppedValue = ss.popAttribute(timestamp, quark);
- /*
- * Verify that the value we are popping matches the one in the
- * event field, unless the latter is undefined.
- */
- if (!functionExitState.isNull() && !functionExitState.equals(poppedValue)) {
- Activator.logWarning(NLS.bind(
- Messages.CallStackStateProvider_UnmatchedPoppedValue,
- functionExitState,
- poppedValue));
- }
+ String threadName = getThreadName(event);
+ long threadId = getThreadId(event);
+ if (threadName == null) {
+ threadName = Long.toString(threadId);
}
+ int threadQuark = ss.getQuarkRelativeAndAdd(processQuark, threadName);
+ ss.updateOngoingState(TmfStateValue.newValueLong(threadId), threadQuark);
+
+ int callStackQuark = ss.getQuarkRelativeAndAdd(threadQuark, CALL_STACK);
+ ITmfStateValue value = functionEntryName;
+ ss.pushAttribute(timestamp, value, callStackQuark);
+ return;
+ }
- } catch (AttributeNotFoundException e) {
- e.printStackTrace();
+ /* Check if the event is a function exit */
+ ITmfStateValue functionExitState = functionExit(event);
+ if (functionExitState != null) {
+ long timestamp = event.getTimestamp().toNanos();
+ String processName = getProcessName(event);
+ if (processName == null) {
+ int processId = getProcessId(event);
+ processName = (processId == UNKNOWN_PID) ? UNKNOWN : Integer.toString(processId);
+ }
+ String threadName = getThreadName(event);
+ if (threadName == null) {
+ threadName = Long.toString(getThreadId(event));
+ }
+ int quark = ss.getQuarkAbsoluteAndAdd(PROCESSES, processName, threadName, CALL_STACK);
+ ITmfStateValue poppedValue = ss.popAttribute(timestamp, quark);
+ /*
+ * Verify that the value we are popping matches the one in the
+ * event field, unless the latter is undefined.
+ */
+ if (!functionExitState.isNull() && !functionExitState.equals(poppedValue)) {
+ Activator.logWarning(NLS.bind(
+ Messages.CallStackStateProvider_UnmatchedPoppedValue,
+ functionExitState,
+ poppedValue));
+ }
}
}
/*******************************************************************************
- * Copyright (c) 2014, 2015 Ericsson
+ * Copyright (c) 2014, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.osgi.util.NLS;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
import org.eclipse.tracecompass.tmf.core.event.ITmfEvent;
try {
ITmfStateValue value = fSS.querySingleState(event.getTimestamp().getValue(), fAttribute).getStateValue();
return checkNotNull(value.toString());
- } catch (AttributeNotFoundException | StateSystemDisposedException e) {
+ } catch (StateSystemDisposedException e) {
return null;
}
}
import java.util.TreeSet;
import org.eclipse.jdt.annotation.Nullable;
-import org.eclipse.tracecompass.internal.tmf.core.Activator;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystemBuilder;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
/**
* This class allows to recycle state system attributes. Instead of creating a
if (!fQuarksInUse.remove(quark)) {
throw new IllegalArgumentException();
}
- try {
- fSs.removeAttribute(ts, quark);
- } catch (AttributeNotFoundException e) {
- Activator.logError("Error getting sub-attributes", e); //$NON-NLS-1$
- }
+ fSs.removeAttribute(ts, quark);
fAvailableQuarks.add(quark);
}
/*******************************************************************************
- * Copyright (c) 2013, 2014 Ericsson
+ * Copyright (c) 2013, 2016 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.tracecompass.internal.tmf.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.ui.Messages;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.statevalue.ITmfStateValue;
if (!value.isNull()) {
return fView.getFunctionName(entry.getTrace(), entry.getProcessId(), event.getTime(), value);
}
- } catch (AttributeNotFoundException e) {
- Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
} catch (TimeRangeException e) {
Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
} catch (StateSystemDisposedException e) {
gc.setForeground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE));
Utils.drawText(gc, name, bounds.x, bounds.y, bounds.width, bounds.height, true, true);
}
- } catch (AttributeNotFoundException e) {
- Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
} catch (TimeRangeException e) {
Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
} catch (StateSystemDisposedException e) {
viewer.getTimeGraphControl().fireSelectionChanged();
startZoomThread(viewer.getTime0(), viewer.getTime1());
- } catch (AttributeNotFoundException | TimeRangeException | StateSystemDisposedException | StateValueTypeException e) {
+ } catch (TimeRangeException | StateSystemDisposedException | StateValueTypeException e) {
Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
}
}
viewer.getTimeGraphControl().fireSelectionChanged();
startZoomThread(viewer.getTime0(), viewer.getTime1());
- } catch (AttributeNotFoundException | TimeRangeException | StateSystemDisposedException | StateValueTypeException e) {
+ } catch (TimeRangeException | StateSystemDisposedException | StateValueTypeException e) {
Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
}
}
/*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2016 École Polytechnique de Montréal and others.
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
-import org.eclipse.tracecompass.statesystem.core.exceptions.AttributeNotFoundException;
import org.eclipse.tracecompass.statesystem.core.exceptions.StateSystemDisposedException;
import org.eclipse.tracecompass.statesystem.core.exceptions.TimeRangeException;
import org.eclipse.tracecompass.statesystem.core.interval.ITmfStateInterval;
private boolean updateStateEntries(ITmfStateSystem ss, List<ITmfStateInterval> fullState, TmfTreeViewerEntry parent, int parentQuark, long timestamp) {
boolean changed = false;
- try {
- for (int quark : ss.getSubAttributes(parentQuark, false)) {
- if (quark >= fullState.size()) {
- // attribute was created after the full state query
- continue;
- }
- ITmfStateInterval interval = fullState.get(quark);
- StateEntry stateEntry = findStateEntry(parent, quark);
- if (stateEntry == null) {
- boolean modified = fFilterStatus ?
- interval.getStartTime() == timestamp :
- !interval.getStateValue().isNull();
- stateEntry = new StateEntry(ss.getAttributeName(quark), quark, ss.getFullAttributePath(quark),
- interval.getStateValue(),
- TmfTimestamp.fromNanos(interval.getStartTime()),
- TmfTimestamp.fromNanos(interval.getEndTime()),
- modified);
-
- // update children first to know if parent is really needed
- updateStateEntries(ss, fullState, stateEntry, quark, timestamp);
-
- /*
- * Add this entry to parent if filtering is off, or
- * if the entry has children to display, or
- * if there is a state change at the current timestamp
- */
- if (!fFilterStatus || stateEntry.hasChildren() || interval.getStartTime() == timestamp) {
- parent.addChild(stateEntry);
- changed = true;
- }
- } else {
- stateEntry.update(interval.getStateValue(),
- TmfTimestamp.fromNanos(interval.getStartTime()),
- TmfTimestamp.fromNanos(interval.getEndTime()));
+ for (int quark : ss.getSubAttributes(parentQuark, false)) {
+ if (quark >= fullState.size()) {
+ // attribute was created after the full state query
+ continue;
+ }
+ ITmfStateInterval interval = fullState.get(quark);
+ StateEntry stateEntry = findStateEntry(parent, quark);
+ if (stateEntry == null) {
+ boolean modified = fFilterStatus ?
+ interval.getStartTime() == timestamp :
+ !interval.getStateValue().isNull();
+ stateEntry = new StateEntry(ss.getAttributeName(quark), quark, ss.getFullAttributePath(quark),
+ interval.getStateValue(),
+ TmfTimestamp.fromNanos(interval.getStartTime()),
+ TmfTimestamp.fromNanos(interval.getEndTime()),
+ modified);
+
+ // update children first to know if parent is really needed
+ updateStateEntries(ss, fullState, stateEntry, quark, timestamp);
- // update children recursively
- updateStateEntries(ss, fullState, stateEntry, quark, timestamp);
+ /*
+ * Add this entry to parent if filtering is off, or
+ * if the entry has children to display, or
+ * if there is a state change at the current timestamp
+ */
+ if (!fFilterStatus || stateEntry.hasChildren() || interval.getStartTime() == timestamp) {
+ parent.addChild(stateEntry);
+ changed = true;
}
+ } else {
+ stateEntry.update(interval.getStateValue(),
+ TmfTimestamp.fromNanos(interval.getStartTime()),
+ TmfTimestamp.fromNanos(interval.getEndTime()));
+ // update children recursively
+ updateStateEntries(ss, fullState, stateEntry, quark, timestamp);
}
- } catch (AttributeNotFoundException e) {
- /* Should not happen, we're iterating on known attributes */
+
}
return changed;
}