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 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.lttng
.ui
.model
.trange
;
15 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.timeAnalysis
.model
.ITimeEvent
;
16 import org
.eclipse
.linuxtools
.tmf
.ui
.viewers
.timeAnalysis
.model
.ITmfTimeAnalysisEntry
;
22 public class TimeRangeEvent
extends TimeRangeComponent
implements ITimeEvent
{
23 // =======================================================================
25 // =======================================================================
26 TimeRangeComposite parent
= null;
28 public static enum Type
{
29 UNKNOWN
, PROPERTY
, PROCESS_MODE
, BDEV_MODE
, TRAP_MODE
, SOFT_IRQ_MODE
, IRQ_MODE
, CPU_MODE
32 protected Type eventType
= Type
.UNKNOWN
;
33 protected String stateMode
= "";
35 // =======================================================================
37 // =======================================================================
40 * Event Start Time (may be unknown)
42 * Event EndTime (may be unknown)
47 public TimeRangeEvent(Long stime
, Long etime
,
48 TimeRangeComposite eventParent
, Type type
, String stateMode
) {
49 super(stime
, etime
, eventParent
);
51 this.eventType
= type
;
52 this.stateMode
= stateMode
;
55 // =======================================================================
57 // =======================================================================
64 * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#getTime
67 public long getTime() {
68 // The value provided by this method is used to start drawing the
70 // so a null value shall not be provided.
71 // If the actual start time is unknown then use the start of the Trace
73 // starting reference point.
74 if (startTime
== null) {
75 return eventParent
.getStartTime();
84 * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#getEntry
87 public ITmfTimeAnalysisEntry
getEntry() {
92 * return the duration between end and start time , if the start time or end
93 * time are unknown, use the Trace start and End times to estimate it, this
94 * value will be used to draw the time range and need to provide a valid
97 * @return the duration
102 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#
105 public long getDuration() {
107 long endT
= (stopTime
== null) ? parent
.getStopTime() : stopTime
;
108 long startT
= (startTime
== null) ? parent
.getStartTime() : startTime
;
111 return stopTime
- startTime
;
119 public String
getStateMode() {
126 public void setStateMode(String stateMode
) {
127 if (stateMode
!= null) {
128 this.stateMode
= stateMode
;
135 * @see org.eclipse.linuxtools.lttng.ui.model.ITimeRangeComponent#getName()
138 public String
getName() {
145 public Type
getEventType() {
152 public void setEventType(Type eventType
) {
153 this.eventType
= eventType
;