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
.internal
.lttng
.ui
.model
.trange
;
15 import org
.eclipse
.linuxtools
.internal
.lttng
.ui
.viewers
.timeAnalysis
.model
.ITimeEvent
;
16 import org
.eclipse
.linuxtools
.internal
.lttng
.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
= ""; //$NON-NLS-1$
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
68 public long getTime() {
69 // The value provided by this method is used to start drawing the
71 // so a null value shall not be provided.
72 // If the actual start time is unknown then use the start of the Trace
74 // starting reference point.
75 if (startTime
== null) {
76 return eventParent
.getStartTime();
85 * org.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#getEntry
89 public ITmfTimeAnalysisEntry
getEntry() {
94 * return the duration between end and start time , if the start time or end
95 * time are unknown, use the Trace start and End times to estimate it, this
96 * value will be used to draw the time range and need to provide a valid
99 * @return the duration
104 * @seeorg.eclipse.linuxtools.tmf.ui.viewers.timeAnalysis.model.ITimeEvent#
108 public long getDuration() {
110 long endT
= (stopTime
== null) ? parent
.getStopTime() : stopTime
;
111 long startT
= (startTime
== null) ? parent
.getStartTime() : startTime
;
114 return stopTime
- startTime
;
122 public String
getStateMode() {
129 public void setStateMode(String stateMode
) {
130 if (stateMode
!= null) {
131 this.stateMode
= stateMode
;
138 * @see org.eclipse.linuxtools.lttng.ui.model.ITimeRangeComponent#getName()
141 public String
getName() {
148 public Type
getEventType() {
155 public void setEventType(Type eventType
) {
156 this.eventType
= eventType
;