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
.lttng
.state
.model
;
14 import org
.eclipse
.linuxtools
.lttng
.state
.StateStrings
;
17 * <b><u>LttngExecutionState</u></b>
21 public class LttngExecutionState
implements Cloneable
{
22 // ========================================================================
24 // =======================================================================
25 private Long entry_LttTime
= null;
26 private Long change_LttTime
= null;
27 private Long cum_cpu_time_Timens
= null;
29 private StateStrings
.ProcessStatus proc_status
= StateStrings
.ProcessStatus
.LTTV_STATE_UNNAMED
;
30 private StateStrings
.ExecutionMode exec_mode
= StateStrings
.ExecutionMode
.LTTV_STATE_MODE_UNKNOWN
;
31 private String exec_submode
= StateStrings
.ExecutionSubMode
.LTTV_STATE_SUBMODE_UNKNOWN
.getInName();
34 public LttngExecutionState
clone() {
35 LttngExecutionState newState
= null;
38 newState
= (LttngExecutionState
)super.clone();
41 // Basic type in java are immutable!
42 // Thus, using assignation ("=") on basic type is CORRECT,
43 // but we should ALWAYS use "new" or "clone()" on "non basic" type
44 newState
.cum_cpu_time_Timens
= this.cum_cpu_time_Timens
;
45 newState
.exec_submode
= this.exec_submode
;
47 // ProcessStatus and ExecutionMode are enum, and so shouldn't be a problem to use their reference
48 newState
.proc_status
= this.proc_status
;
49 newState
.exec_mode
= this.exec_mode
;
50 newState
.entry_LttTime
= this.entry_LttTime
;
51 newState
.change_LttTime
= this.change_LttTime
;
53 catch ( CloneNotSupportedException e
) {
54 System
.out
.println("Cloning failed with : " + e
.getMessage() );
60 // ========================================================================
62 // =======================================================================
64 * @return the entry_LttTime
66 public Long
getEntry_LttTime() {
72 * the entry_LttTime to set
74 public void setEntry_Time(Long entryLttTime
) {
75 entry_LttTime
= entryLttTime
;
79 * @return the change_LttTime
81 public Long
getChange_LttTime() {
82 return change_LttTime
;
86 * @param changeLttTime
87 * the change_LttTime to set
89 public void setChange_Time(Long changeLttTime
) {
90 change_LttTime
= changeLttTime
;
94 * @return the cum_cpu_time_LttTime
96 public Long
getCum_cpu_time() {
97 return cum_cpu_time_Timens
;
101 * @param cumCpuTimeLttTime
102 * the cum_cpu_time_LttTime to set
104 public void setCum_cpu_time(Long cumCpuTime
) {
105 cum_cpu_time_Timens
= cumCpuTime
;
109 * @return the proc_status
111 public StateStrings
.ProcessStatus
getProc_status() {
117 * the proc_status to set
119 public void setProc_status(StateStrings
.ProcessStatus procStatus
) {
120 proc_status
= procStatus
;
124 * @return the exec_mode
126 public StateStrings
.ExecutionMode
getExec_mode() {
132 * the exec_mode to set
134 public void setExec_mode(StateStrings
.ExecutionMode execMode
) {
135 exec_mode
= execMode
;
139 * @return the exec_submode
141 public String
getExec_submode() {
147 * the exec_submode to set
149 public void setExec_submode(String execSubmode
) {
150 exec_submode
= execSubmode
;
154 @SuppressWarnings("nls")
155 public String
toString() {
156 return "[LttngExecutionState: " + "entry=" + entry_LttTime
+ ",change=" + change_LttTime
+ ",cum_cpu=" + cum_cpu_time_Timens
+
157 ",pstatus=" + proc_status
+ ",emode=" + exec_mode
+ ",esubmode=" + exec_submode
+"]";