Skip to main content
summaryrefslogtreecommitdiffstats
blob: 7cf42f2cd70080653e3d6a1916a9d1b20bd3b9ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*******************************************************************************
 * Copyright (c) 2009 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:
 *   Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation
 *******************************************************************************/
package org.eclipse.linuxtools.lttng.ui.model.trange;

import java.util.Vector;

import org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITmfTimeAnalysisEntry;

public class TimeRangeComposite extends TimeRangeComponent implements
ITmfTimeAnalysisEntry {

	// ========================================================================
	// Data
	// =======================================================================
	/**
	 * Type of Composites or Containers
	 * <p>
	 * PROPERTY: Refers to a sub-composite of a RESOURCE or a PROCESS e.g the
	 * cpu which can vary over time and can have time range events associated to
	 * it, and at the same time PROPERTY is associated to a Composite parent
	 * like a PROCESS
	 * </p>
	 * <p>
	 * PROCESS: A composite of time range events representing a Process
	 * </p>
	 * <p>
	 * RESOURCE: A composite of time range events representing a resource i.g.
	 * irq, softIrq, trap, bdev, cpu
	 * </p>
	 * 
	 * @author alvaro
	 * 
	 */
	public static enum CompositeType {
		UNKNOWN, PROPERTY, PROCESS, RESOURCE
	}

	protected final Vector<TimeRangeComponent> ChildEventLeafs = new Vector<TimeRangeComponent>();
	protected final Vector<TimeRangeComponent> ChildEventComposites = new Vector<TimeRangeComponent>();
	protected Integer id = 0;
	protected String name;
	protected String groupName = "";
	protected String className = "";
	protected CompositeType contType = CompositeType.UNKNOWN;
	protected Long next_good_time = -1L;
	/*Time of first event which trigger the creation of this local resource */
	protected Long insertionTime = -1L; 

	// ========================================================================
	// Constructors
	// =======================================================================
	public TimeRangeComposite(Integer id, Long stime, Long etime, String name,
			CompositeType type, long insertionTime) {
		super(stime, etime, null);
		this.id = id;
		this.name = name;
		contType = type;
		this.insertionTime = insertionTime;
		// Adjust the first good drawing position to the event time creating this resource
		next_good_time = insertionTime;
	}

	public TimeRangeComposite(Integer id, Long stime, Long etime, String name,
			String groupName, String className, CompositeType type,
			long insertionTime) {
		this(id, stime, etime, name, type, insertionTime);
		this.groupName = groupName;
		this.className = className;
    }
	
	// ========================================================================
	// Methods
	// =======================================================================

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.eclipse.linuxtools.lttng.ui.model.trange.TimeRangeComponent#getName()
	 */
	@Override
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
	 * ITmfTimeAnalysisEntry#getGroupName()
	 */
	public String getGroupName() {
		return groupName;
	}

	/**
	 * @param groupName
	 */
	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
	 * ITmfTimeAnalysisEntry#getId()
	 */
	public int getId() {
		return id;
	}

	/**
	 * @param id
	 */
	public void setId(int id) {
		this.id = id;
	}

	/**
	 * @return
	 */
	public String getClassName() {
		return className;
	}

	/**
	 * @param className
	 */
	public void setClassName(String className) {
		this.className = className;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.
	 * ITmfTimeAnalysisEntry#getTraceEvents()
	 */
	@SuppressWarnings("unchecked")
	public Vector<TimeRangeComponent> getTraceEvents() {
		return ChildEventLeafs;
	}

	/**
	 * @return
	 */
	public Vector<TimeRangeComponent> getChildEventComposites() {
		return ChildEventComposites;
	}

	/**
	 * Represents the time where the next time range can start the drawing i.e.
	 * right after previous time range.
	 * 
	 * @return
	 */
	public long getNext_good_time() {
		return next_good_time;
	}

	/**
	 * Represents the time where the next time range can start the drawing i.e.
	 * right after previous time range.
	 * 
	 * @param nextGoodTime
	 */
	public void setNext_good_time(long nextGoodTime) {
		next_good_time = nextGoodTime;
	}

	/**
	 * Reset this resource to the construction state
	 */
	public void reset() {
		getChildEventComposites().clear();
		getTraceEvents().clear();
		next_good_time = insertionTime;
	}

	/**
	 * Event Time reflecting the creation of this local resource e.g. at Reception of Fork, etc.
	 * 
	 * @return
	 */
	public long getInsertionTime() {
		return insertionTime;
	}
}

Back to the top