traceEntry.updateEndTime(end);
}
- List<Integer> processQuarks = ss.getQuarks(module.getProcessesPattern());
- for (int processQuark : processQuarks) {
-
- /*
- * Default to trace entry, overwrite if a process entry exists.
- */
- TimeGraphEntry threadParent = traceEntry;
- int processId = -1;
- if (processQuark != ITmfStateSystem.ROOT_ATTRIBUTE) {
- /* Create the entry for the process */
- ProcessEntry processEntry = processEntryMap.get(processQuark);
- if (processEntry == null) {
- String name = ss.getAttributeName(processQuark);
- /* The attribute name should already be parseable to integer */
- processId = Integer.parseInt(name);
- processEntry = new ProcessEntry(name, processId, start, end);
- processEntryMap.put(processQuark, processEntry);
- traceEntry.addChild(processEntry);
- } else {
- processEntry.updateEndTime(end);
+ try {
+ List<ITmfStateInterval> endStates = ss.queryFullState(ss.getCurrentEndTime());
+
+ List<Integer> processQuarks = ss.getQuarks(module.getProcessesPattern());
+ for (int processQuark : processQuarks) {
+
+ /*
+ * Default to trace entry, overwrite if a process entry exists.
+ */
+ TimeGraphEntry threadParent = traceEntry;
+ int processId = -1;
+ if (processQuark != ITmfStateSystem.ROOT_ATTRIBUTE) {
+ /* Create the entry for the process */
+ ProcessEntry processEntry = processEntryMap.get(processQuark);
+ if (processEntry == null) {
+ String processName = ss.getAttributeName(processQuark);
+ ITmfStateValue processStateValue = endStates.get(processQuark).getStateValue();
+ if (processStateValue.getType() == Type.INTEGER) {
+ processId = processStateValue.unboxInt();
+ } else {
+ try {
+ processId = Integer.parseInt(processName);
+ } catch (NumberFormatException e) {
+ /* use default processId */
+ }
+ }
+ processEntry = new ProcessEntry(processName, processId, start, end);
+ processEntryMap.put(processQuark, processEntry);
+ traceEntry.addChild(processEntry);
+ } else {
+ processEntry.updateEndTime(end);
+ }
+ /* The parent of the thread entries will be a process */
+ threadParent = processEntry;
}
- /* The parent of the thread entries will be a process */
- threadParent = processEntry;
- }
- /* Create the threads under the process */
- try {
+ /* Create the threads under the process */
List<Integer> threadQuarks = ss.getQuarks(processQuark, module.getThreadsPattern());
/*
* Only query startStates if necessary (threadEntry == null)
*/
List<ITmfStateInterval> startStates = null;
- List<ITmfStateInterval> endStates = ss.queryFullState(ss.getCurrentEndTime());
for (int threadQuark : threadQuarks) {
if (monitor.isCanceled()) {
return;
if (startStates == null) {
startStates = ss.queryFullState(ss.getStartTime());
}
- long threadId = endStates.get(threadQuark).getStateValue().unboxLong();
+ long threadId = -1;
+ ITmfStateValue threadStateValue = endStates.get(threadQuark).getStateValue();
+ if (threadStateValue.getType() == Type.LONG || threadStateValue.getType() == Type.INTEGER) {
+ threadId = threadStateValue.unboxLong();
+ } else {
+ try {
+ threadId = Long.parseLong(threadName);
+ } catch (NumberFormatException e) {
+ /* use default threadId */
+ }
+ }
long threadStart = start;
ITmfStateInterval startInterval = startStates.get(callStackQuark);
if (startInterval.getStateValue().isNull()) {
level++;
}
}
- } catch (AttributeNotFoundException e) {
- Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
- } catch (StateSystemDisposedException e) {
- /* Ignored */
}
+ } catch (AttributeNotFoundException e) {
+ Activator.getDefault().logError("Error querying state system", e); //$NON-NLS-1$
+ } catch (StateSystemDisposedException e) {
+ /* Ignored */
}
if (parentTrace == getTrace()) {
refresh();
}
- for (ITimeGraphEntry processEntry : traceEntry.getChildren()) {
- for (ITimeGraphEntry threadEntry : processEntry.getChildren()) {
- for (ITimeGraphEntry callStackEntry : threadEntry.getChildren()) {
- if (monitor.isCanceled()) {
- return;
- }
- buildStatusEvents(parentTrace, (CallStackEntry) callStackEntry, monitor, ss.getStartTime(), end);
+ Consumer<TimeGraphEntry> consumer = new Consumer<TimeGraphEntry>() {
+ @Override
+ public void accept(TimeGraphEntry entry) {
+ if (monitor.isCanceled()) {
+ return;
+ }
+ if (entry instanceof CallStackEntry) {
+ buildStatusEvents(parentTrace, (CallStackEntry) entry, monitor, ss.getStartTime(), end);
+ return;
}
+ entry.getChildren().forEach(this);
}
- }
+ };
+ traceEntry.getChildren().forEach(consumer);
+
start = end;
}
}
}
/**
- * @since 2.0
+ * @since 1.2
*/
@Override
protected final List<ITimeEvent> getEventList(TimeGraphEntry tgentry, long startTime, long endTime, long resolution, IProgressMonitor monitor) {
}
/**
- * @since 2.0
+ * @since 1.2
*/
@Override
protected void synchingToTime(final long time) {
}
/**
- * @since 2.0
+ * @since 1.2
*/
@Override
protected void fillLocalToolBar(IToolBarManager manager) {
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$
}
}