1 /*******************************************************************************
2 * Copyright (c) 2009 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 * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
11 *******************************************************************************/
12 package org
.eclipse
.linuxtools
.internal
.lttng
.ui
.model
.trange
;
14 import java
.util
.Iterator
;
15 import java
.util
.Vector
;
17 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.viewers
.timeAnalysis
.model
.ITimeEvent
;
18 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.viewers
.timeAnalysis
.model
.ITmfTimeAnalysisEntry
;
20 public class TimeRangeComposite
extends TimeRangeComponent
implements
21 ITmfTimeAnalysisEntry
{
23 // ========================================================================
25 // =======================================================================
27 * Type of Composites or Containers
29 * PROPERTY: Refers to a sub-composite of a RESOURCE or a PROCESS e.g the
30 * cpu which can vary over time and can have time range events associated to
31 * it, and at the same time PROPERTY is associated to a Composite parent
35 * PROCESS: A composite of time range events representing a Process
38 * RESOURCE: A composite of time range events representing a resource i.g.
39 * irq, softIrq, trap, bdev, cpu
45 public static enum CompositeType
{
46 UNKNOWN
, PROPERTY
, PROCESS
, RESOURCE
49 protected final Vector
<TimeRangeComponent
> ChildEventLeafs
= new Vector
<TimeRangeComponent
>();
50 protected final Vector
<TimeRangeComponent
> ChildEventComposites
= new Vector
<TimeRangeComponent
>();
51 protected Integer id
= 0;
52 protected String name
;
53 protected String groupName
= ""; //$NON-NLS-1$
54 protected String className
= ""; //$NON-NLS-1$
55 protected CompositeType contType
= CompositeType
.UNKNOWN
;
56 protected Long next_good_time
= -1L;
57 /*Time of first event which trigger the creation of this local resource */
58 protected Long insertionTime
= -1L;
60 // ========================================================================
62 // =======================================================================
63 public TimeRangeComposite(Integer id
, Long stime
, Long etime
, String name
,
64 CompositeType type
, long insertionTime
) {
65 super(stime
, etime
, null);
69 this.insertionTime
= insertionTime
;
70 // Adjust the first good drawing position to the event time creating this resource
71 next_good_time
= insertionTime
;
74 public TimeRangeComposite(Integer id
, Long stime
, Long etime
, String name
,
75 String groupName
, String className
, CompositeType type
,
77 this(id
, stime
, etime
, name
, type
, insertionTime
);
78 this.groupName
= groupName
;
79 this.className
= className
;
82 // ========================================================================
84 // =======================================================================
90 * org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent#getName()
93 public String
getName() {
100 public void setName(String name
) {
107 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
108 * ITmfTimeAnalysisEntry#getGroupName()
111 public String
getGroupName() {
118 public void setGroupName(String groupName
) {
119 this.groupName
= groupName
;
125 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
126 * ITmfTimeAnalysisEntry#getId()
136 public void setId(int id
) {
143 public String
getClassName() {
150 public void setClassName(String className
) {
151 this.className
= className
;
157 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
158 * ITmfTimeAnalysisEntry#getTraceEvents()
161 @SuppressWarnings("unchecked")
162 @Deprecated public Vector
<TimeRangeComponent
> getTraceEvents() {
163 return ChildEventLeafs
;
167 @SuppressWarnings("unchecked")
168 public Iterator
<TimeRangeComponent
> getTraceEventsIterator() {
169 Vector
<TimeRangeComponent
> clone
= (Vector
<TimeRangeComponent
>) ChildEventLeafs
.clone();
170 return clone
.iterator();
174 @SuppressWarnings("unchecked")
175 public Iterator
<TimeRangeComponent
> getTraceEventsIterator(long startTime
, long stopTime
, long visibleDuration
) {
176 return getTraceEventsIterator();
180 public void addTraceEvent(ITimeEvent event
) {
181 if (event
instanceof TimeRangeComponent
) {
182 ChildEventLeafs
.add((TimeRangeComponent
) event
);
189 public Vector
<TimeRangeComponent
> getChildEventComposites() {
190 return ChildEventComposites
;
194 * Represents the time where the next time range can start the drawing i.e.
195 * right after previous time range.
199 public long getNext_good_time() {
200 return next_good_time
;
204 * Represents the time where the next time range can start the drawing i.e.
205 * right after previous time range.
207 * @param nextGoodTime
209 public void setNext_good_time(long nextGoodTime
) {
210 next_good_time
= nextGoodTime
;
214 * Reset this resource to the construction state
216 public void reset() {
217 getChildEventComposites().clear();
218 getTraceEvents().clear();
219 next_good_time
= insertionTime
;
223 * Event Time reflecting the creation of this local resource e.g. at Reception of Fork, etc.
227 public long getInsertionTime() {
228 return insertionTime
;
232 @SuppressWarnings("nls")
233 public String
toString() {
234 return "[TimeRangeComposite:" + super.toString() +
235 ",id=" + id
+ ",name=" + name
+ ",group=" + groupName
+ ",class=" + className
+
236 ",ctype=" + contType
+ ",itime=" + insertionTime
+
237 ",leaves=" + ChildEventLeafs
+ ",composites=" + ChildEventComposites
+ "]";
This page took 0.036826 seconds and 5 git commands to generate.