* Version number of this state provider. Please bump this if you modify the
* contents of the generated state history in some way.
*/
- private static final int VERSION = 1;
+ private static final int VERSION = 2;
/* Event names HashMap. TODO: This can be discarded once we move to Java 7 */
private final HashMap<String, Integer> knownEventNames;
value = TmfStateValue.newValueString(nextProcessName);
ss.modifyAttribute(ts, value, quark);
- /*
- * Check if we need to set the syscall state and the PPID of
- * the new process (in case we haven't seen this process before)
- */
- quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.SYSTEM_CALL);
- if (ss.isLastAttribute(quark)) { /* Did we just add this attribute? */
- value = TmfStateValue.nullValue();
- ss.modifyAttribute(ts, value, quark);
- }
- quark = ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.PPID);
- if (ss.isLastAttribute(quark)) {
- value = TmfStateValue.nullValue();
- ss.modifyAttribute(ts, value, quark);
- }
+ /* Make sure the PPID and system_call sub-attributes exist */
+ ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.SYSTEM_CALL);
+ ss.getQuarkRelativeAndAdd(newCurrentThreadNode, Attributes.PPID);
/* Set the current scheduled process on the relevant CPU */
quark = ss.getQuarkRelativeAndAdd(currentCPUNode, Attributes.CURRENT_THREAD);
import java.util.List;
import org.eclipse.linuxtools.tmf.core.exceptions.AttributeNotFoundException;
+import org.eclipse.linuxtools.tmf.core.exceptions.StateValueTypeException;
+import org.eclipse.linuxtools.tmf.core.exceptions.TimeRangeException;
+import org.eclipse.linuxtools.tmf.core.statevalue.TmfStateValue;
/**
* The Attribute Tree is the /proc-like filesystem used to organize attributes.
}
prevNode = nextNode;
}
- return attributeList.size() - 1;
+ /*
+ * Insert an initial null value for this attribute in the state
+ * system (in case the state provider doesn't set one).
+ */
+ final int newAttrib = attributeList.size() - 1;
+ try {
+ ss.modifyAttribute(ss.getStartTime(), TmfStateValue.nullValue(), newAttrib);
+ } catch (TimeRangeException e) {
+ /* Should not happen, we're inserting at ss's start time */
+ throw new RuntimeException();
+ } catch (AttributeNotFoundException e) {
+ /* Should not happen, we just created this attribute! */
+ throw new RuntimeException();
+ } catch (StateValueTypeException e) {
+ /* Should not happen, there is no existing state value, and the
+ * one we insert is a null value anyway. */
+ throw new RuntimeException();
+ }
+
+ return newAttrib;
}
/*
* The attribute was already existing, return the quark of that