@Override protected @Nullable List<ITimeEvent> getEventList( @NonNull TimeGraphEntry entry, ITmfStateSystem ssq, @NonNull List<List<ITmfStateInterval>> fullStates, @Nullable List<ITmfStateInterval> prevFullState, @NonNull IProgressMonitor monitor) { List<ITimeEvent> eventList = null; // List<List<ITimeEvent>> List = new ArrayList<>(fullStates.size()); OPS_NEUTRON_ENTRY resourcesEntry = (OPS_NEUTRON_ENTRY) entry; int quark = resourcesEntry.getQuark(); if (resourcesEntry.getType().equals(Type.SERVICE)) { int statusQuark; try { statusQuark = ssq.getQuarkRelative(quark, "Action"); // $NON-NLS-1$ } catch (AttributeNotFoundException e) { e.printStackTrace(); return null; } eventList = new ArrayList<>(fullStates.size()); ITmfStateInterval lastInterval = prevFullState == null || statusQuark >= prevFullState.size() ? null : prevFullState.get(statusQuark); long lastStartTime = lastInterval == null ? -1 : lastInterval.getStartTime(); long lastEndTime = lastInterval == null ? -1 : lastInterval.getEndTime() + 1; for (List<ITmfStateInterval> fullState : fullStates) { if (monitor.isCanceled()) { return null; } if (statusQuark >= fullState.size()) { // No information on this CPU (yet?), skip it for now continue; } ITmfStateInterval statusInterval = fullState.get(statusQuark); int status = statusInterval.getStateValue().unboxInt(); long time = statusInterval.getStartTime(); long duration = statusInterval.getEndTime() - time + 1; if (time == lastStartTime) { continue; } if (!statusInterval.getStateValue().isNull()) { if (lastEndTime != time && lastEndTime != -1) { eventList.add(new TimeEvent(entry, lastEndTime, time - lastEndTime)); } eventList.add(new TimeEvent(entry, time, duration, status)); } else { eventList.add(new NullTimeEvent(entry, time, duration)); } lastStartTime = time; lastEndTime = time + duration; } } return eventList; }
private static boolean isIntervalInStateActive(ITmfStateInterval ival) { int value = ival.getStateValue().unboxInt(); /* An entry is only active when running */ if (value == StateValues.PROCESS_STATUS_RUN_USERMODE || value == StateValues.PROCESS_STATUS_RUN_SYSCALL || value == StateValues.PROCESS_STATUS_INTERRUPTED) { return true; } return false; }