1 /*******************************************************************************
2 * Copyright (c) 2012 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Patrick Tasse - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.ui
.views
.resources
;
15 import java
.util
.ArrayList
;
16 import java
.util
.Iterator
;
17 import java
.util
.List
;
19 import org
.eclipse
.linuxtools
.internal
.lttng2
.kernel
.ui
.views
.common
.EventIterator
;
20 import org
.eclipse
.linuxtools
.lttng2
.kernel
.core
.trace
.CtfKernelTrace
;
21 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeEvent
;
22 import org
.eclipse
.linuxtools
.tmf
.ui
.widgets
.timegraph
.model
.ITimeGraphEntry
;
25 * An entry, or row, in the resource view
27 * @author Patrick Tasse
29 public class ResourcesEntry
implements ITimeGraphEntry
{
31 /** Type of resource */
32 public static enum Type
{
33 /** Null resources (filler rows, etc.) */
35 /** Entries for CPUs */
37 /** Entries for IRQs */
39 /** Entries for Soft IRQ */
42 private final int fQuark
;
43 private final CtfKernelTrace fTrace
;
44 private ITimeGraphEntry fParent
= null;
45 private final ITimeGraphEntry
[] children
= null;
46 private final String fName
;
47 private final Type fType
;
48 private final int fId
;
49 private long fStartTime
;
50 private long fEndTime
;
51 private List
<ITimeEvent
> fEventList
= new ArrayList
<ITimeEvent
>();
52 private List
<ITimeEvent
> fZoomedEventList
= null;
55 * Standard constructor
58 * The quark of the state system attribute whose state is shown
61 * The trace that this view is talking about
63 * Type of entry, see the Type enum
65 * The integer id associated with this entry or row
67 public ResourcesEntry(int quark
, CtfKernelTrace trace
, Type type
, int id
) {
72 fName
= type
.toString() + ' ' + Integer
.toString(id
);
76 public ITimeGraphEntry
getParent() {
81 public boolean hasChildren() {
82 return children
!= null && children
.length
> 0;
86 public ITimeGraphEntry
[] getChildren() {
91 public String
getName() {
96 public long getStartTime() {
101 public long getEndTime() {
106 public boolean hasTimeEvents() {
111 public Iterator
<ITimeEvent
> getTimeEventsIterator() {
112 return new EventIterator(fEventList
, fZoomedEventList
);
116 public Iterator
<ITimeEvent
> getTimeEventsIterator(long startTime
, long stopTime
, long visibleDuration
) {
117 return new EventIterator(fEventList
, fZoomedEventList
, startTime
, stopTime
);
121 * Assign a parent entry to this one, to organize them in a tree in the
127 public void setParent(ITimeGraphEntry parent
) {
132 * Retrieve the attribute quark that's represented by this entry.
134 * @return The integer quark
136 public int getQuark() {
141 * Retrieve the trace that is associated to this Resource view.
143 * @return The LTTng 2 kernel trace
145 public CtfKernelTrace
getTrace() {
150 * Get the entry Type of this entry. Uses the inner Type enum.
152 * @return The entry type
154 public Type
getType() {
159 * Get the integer ID associated with this entry.
168 * Assign the target event list to this view.
171 * The list of time events
173 public void setEventList(List
<ITimeEvent
> eventList
) {
174 fEventList
= eventList
;
175 if (eventList
!= null && eventList
.size() > 0) {
176 fStartTime
= eventList
.get(0).getTime();
177 ITimeEvent lastEvent
= eventList
.get(eventList
.size() - 1);
178 fEndTime
= lastEvent
.getTime() + lastEvent
.getDuration();
183 * Assign the zoomed event list to this view.
186 * The list of "zoomed" time events
188 public void setZoomedEventList(List
<ITimeEvent
> eventList
) {
189 fZoomedEventList
= eventList
;
This page took 0.034154 seconds and 5 git commands to generate.