-/*******************************************************************************\r
- * Copyright (c) 2012 Ericsson\r
- * \r
- * All rights reserved. This program and the accompanying materials are\r
- * made available under the terms of the Eclipse Public License v1.0 which\r
- * accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
- * Contributors:\r
- * Patrick Tasse - Initial API and implementation\r
- *******************************************************************************/\r
-\r
-package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.common.EventIterator;\r
-import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;\r
-import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;\r
-import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;\r
-\r
-public class ResourcesEntry implements ITimeGraphEntry {\r
- public static enum Type { NULL, CPU, IRQ, SOFT_IRQ };\r
-\r
- private int fQuark;\r
- private CtfKernelTrace fTrace;\r
- private ITimeGraphEntry fParent = null;\r
- private ITimeGraphEntry[] children = null;\r
- private String fName;\r
- private Type fType;\r
- private int fId;\r
- private long fStartTime;\r
- private long fEndTime;\r
- private List<ITimeEvent> fEventList = new ArrayList<ITimeEvent>();\r
- private List<ITimeEvent> fZoomedEventList = null;\r
-\r
- public ResourcesEntry(int quark, CtfKernelTrace trace, Type type, int id) {\r
- fQuark = quark;\r
- fTrace = trace;\r
- fType = type;\r
- fId = id;\r
- fName = type.toString() + ' ' + Integer.toString(id);\r
- }\r
-\r
- @Override\r
- public ITimeGraphEntry getParent() {\r
- return fParent;\r
- }\r
-\r
- @Override\r
- public boolean hasChildren() {\r
- return children != null && children.length > 0;\r
- }\r
-\r
- @Override\r
- public ITimeGraphEntry[] getChildren() {\r
- return children;\r
- }\r
-\r
- @Override\r
- public String getName() {\r
- return fName;\r
- }\r
-\r
- @Override\r
- public long getStartTime() {\r
- return fStartTime;\r
- }\r
-\r
- @Override\r
- public long getEndTime() {\r
- return fEndTime;\r
- }\r
-\r
- @Override\r
- public boolean hasTimeEvents() {\r
- return true;\r
- }\r
-\r
- @Override\r
- public Iterator<ITimeEvent> getTimeEventsIterator() {\r
- return new EventIterator(fEventList, fZoomedEventList);\r
- }\r
-\r
- @Override\r
- public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) {\r
- return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime);\r
- }\r
-\r
- public void setParent(ITimeGraphEntry parent) {\r
- fParent = parent;\r
- }\r
-\r
- public int getQuark() {\r
- return fQuark;\r
- }\r
-\r
- public CtfKernelTrace getTrace() {\r
- return fTrace;\r
- }\r
-\r
- public Type getType() {\r
- return fType;\r
- }\r
-\r
- public int getId() {\r
- return fId;\r
- }\r
-\r
- public void setEventList(List<ITimeEvent> eventList) {\r
- fEventList = eventList;\r
- if (eventList != null && eventList.size() > 0) {\r
- fStartTime = eventList.get(0).getTime();\r
- ITimeEvent lastEvent = eventList.get(eventList.size() - 1);\r
- fEndTime = lastEvent.getTime() + lastEvent.getDuration();\r
- }\r
- }\r
-\r
- public void setZoomedEventList(List<ITimeEvent> eventList) {\r
- fZoomedEventList = eventList;\r
- }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Patrick Tasse - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.resources;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.linuxtools.internal.lttng2.kernel.ui.views.common.EventIterator;
+import org.eclipse.linuxtools.lttng2.kernel.core.trace.CtfKernelTrace;
+import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeEvent;
+import org.eclipse.linuxtools.tmf.ui.widgets.timegraph.model.ITimeGraphEntry;
+
+/**
+ * An entry, or row, in the resource view
+ *
+ * @author Patrick Tasse
+ */
+public class ResourcesEntry implements ITimeGraphEntry {
+
+ /** Type of resource */
+ public static enum Type {
+ /** Null resources (filler rows, etc.) */
+ NULL,
+ /** Entries for CPUs */
+ CPU,
+ /** Entries for IRQs */
+ IRQ,
+ /** Entries for Soft IRQ */
+ SOFT_IRQ }
+
+ private final int fQuark;
+ private final CtfKernelTrace fTrace;
+ private ITimeGraphEntry fParent = null;
+ private final ITimeGraphEntry[] children = null;
+ private final String fName;
+ private final Type fType;
+ private final int fId;
+ private long fStartTime;
+ private long fEndTime;
+ private List<ITimeEvent> fEventList = new ArrayList<ITimeEvent>();
+ private List<ITimeEvent> fZoomedEventList = null;
+
+ /**
+ * Standard constructor
+ *
+ * @param quark
+ * The quark of the state system attribute whose state is shown
+ * on this row
+ * @param trace
+ * The trace that this view is talking about
+ * @param type
+ * Type of entry, see the Type enum
+ * @param id
+ * The integer id associated with this entry or row
+ */
+ public ResourcesEntry(int quark, CtfKernelTrace trace, Type type, int id) {
+ fQuark = quark;
+ fTrace = trace;
+ fType = type;
+ fId = id;
+ fName = type.toString() + ' ' + Integer.toString(id);
+ }
+
+ @Override
+ public ITimeGraphEntry getParent() {
+ return fParent;
+ }
+
+ @Override
+ public boolean hasChildren() {
+ return children != null && children.length > 0;
+ }
+
+ @Override
+ public ITimeGraphEntry[] getChildren() {
+ return children;
+ }
+
+ @Override
+ public String getName() {
+ return fName;
+ }
+
+ @Override
+ public long getStartTime() {
+ return fStartTime;
+ }
+
+ @Override
+ public long getEndTime() {
+ return fEndTime;
+ }
+
+ @Override
+ public boolean hasTimeEvents() {
+ return true;
+ }
+
+ @Override
+ public Iterator<ITimeEvent> getTimeEventsIterator() {
+ return new EventIterator(fEventList, fZoomedEventList);
+ }
+
+ @Override
+ public Iterator<ITimeEvent> getTimeEventsIterator(long startTime, long stopTime, long visibleDuration) {
+ return new EventIterator(fEventList, fZoomedEventList, startTime, stopTime);
+ }
+
+ /**
+ * Assign a parent entry to this one, to organize them in a tree in the
+ * view.
+ *
+ * @param parent
+ * The parent entry
+ */
+ public void setParent(ITimeGraphEntry parent) {
+ fParent = parent;
+ }
+
+ /**
+ * Retrieve the attribute quark that's represented by this entry.
+ *
+ * @return The integer quark
+ */
+ public int getQuark() {
+ return fQuark;
+ }
+
+ /**
+ * Retrieve the trace that is associated to this Resource view.
+ *
+ * @return The LTTng 2 kernel trace
+ */
+ public CtfKernelTrace getTrace() {
+ return fTrace;
+ }
+
+ /**
+ * Get the entry Type of this entry. Uses the inner Type enum.
+ *
+ * @return The entry type
+ */
+ public Type getType() {
+ return fType;
+ }
+
+ /**
+ * Get the integer ID associated with this entry.
+ *
+ * @return The ID
+ */
+ public int getId() {
+ return fId;
+ }
+
+ /**
+ * Assign the target event list to this view.
+ *
+ * @param eventList
+ * The list of time events
+ */
+ public void setEventList(List<ITimeEvent> eventList) {
+ fEventList = eventList;
+ if (eventList != null && eventList.size() > 0) {
+ fStartTime = eventList.get(0).getTime();
+ ITimeEvent lastEvent = eventList.get(eventList.size() - 1);
+ fEndTime = lastEvent.getTime() + lastEvent.getDuration();
+ }
+ }
+
+ /**
+ * Assign the zoomed event list to this view.
+ *
+ * @param eventList
+ * The list of "zoomed" time events
+ */
+ public void setZoomedEventList(List<ITimeEvent> eventList) {
+ fZoomedEventList = eventList;
+ }
+}