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
.LttngConstants
;
15 import org
.eclipse
.linuxtools
.lttng
.state
.StateStrings
;
18 * <b><u>LttngExecutionState</u></b>
22 public class LttngExecutionState
implements Cloneable
{
23 // ========================================================================
25 // =======================================================================
27 private Long entry_LttTime
= null;
28 private Long change_LttTime
= null;
29 private Long cum_cpu_time_Timens
= null;
31 private StateStrings
.ProcessStatus proc_status
= StateStrings
.ProcessStatus
.LTTV_STATE_UNNAMED
;
32 private StateStrings
.ExecutionMode exec_mode
= StateStrings
.ExecutionMode
.LTTV_STATE_MODE_UNKNOWN
;
33 private String exec_submode
= StateStrings
.ExecutionSubMode
.LTTV_STATE_SUBMODE_UNKNOWN
.getInName();
34 // Note: For statistics performance improvement a integer representation of the submode is used
35 // as well as a bit mask is applied!
36 private int exec_submode_id
= Integer
.valueOf(StateStrings
.ExecutionSubMode
.LTTV_STATE_SUBMODE_UNKNOWN
.ordinal() | LttngConstants
.STATS_NONE_ID
);
39 public LttngExecutionState
clone() {
40 LttngExecutionState newState
= null;
43 newState
= (LttngExecutionState
)super.clone();
46 // Basic type in java are immutable!
47 // Thus, using assignation ("=") on basic type is CORRECT,
48 // but we should ALWAYS use "new" or "clone()" on "non basic" type
49 newState
.cum_cpu_time_Timens
= this.cum_cpu_time_Timens
;
50 newState
.exec_submode
= this.exec_submode
;
51 newState
.exec_submode_id
= this.exec_submode_id
;
53 // ProcessStatus and ExecutionMode are enum, and so shouldn't be a problem to use their reference
54 newState
.proc_status
= this.proc_status
;
55 newState
.exec_mode
= this.exec_mode
;
56 newState
.entry_LttTime
= this.entry_LttTime
;
57 newState
.change_LttTime
= this.change_LttTime
;
59 catch ( CloneNotSupportedException e
) {
60 System
.out
.println("Cloning failed with : " + e
.getMessage() ); //$NON-NLS-1$
66 // ========================================================================
68 // =======================================================================
70 * @return the entry_LttTime
72 public Long
getEntry_LttTime() {
78 * the entry_LttTime to set
80 public void setEntry_Time(Long entryLttTime
) {
81 entry_LttTime
= entryLttTime
;
85 * @return the change_LttTime
87 public Long
getChange_LttTime() {
88 return change_LttTime
;
92 * @param changeLttTime
93 * the change_LttTime to set
95 public void setChange_Time(Long changeLttTime
) {
96 change_LttTime
= changeLttTime
;
100 * @return the cum_cpu_time_LttTime
102 public Long
getCum_cpu_time() {
103 return cum_cpu_time_Timens
;
107 * @param cumCpuTimeLttTime
108 * the cum_cpu_time_LttTime to set
110 public void setCum_cpu_time(Long cumCpuTime
) {
111 cum_cpu_time_Timens
= cumCpuTime
;
115 * @return the proc_status
117 public StateStrings
.ProcessStatus
getProc_status() {
123 * the proc_status to set
125 public void setProc_status(StateStrings
.ProcessStatus procStatus
) {
126 proc_status
= procStatus
;
130 * @return the exec_mode
132 public StateStrings
.ExecutionMode
getExec_mode() {
138 * the exec_mode to set
140 public void setExec_mode(StateStrings
.ExecutionMode execMode
) {
141 exec_mode
= execMode
;
145 * @return the exec_submode
147 public String
getExec_submode() {
153 * the exec_submode to set
155 public void setExec_submode(String execSubmode
) {
156 exec_submode
= execSubmode
;
160 * @return the exec_submode
162 public int getExec_submode_id() {
163 return exec_submode_id
;
168 * the exec_submode id to set
170 public void setExec_submode_id(int execSubmodeId
) {
171 exec_submode_id
= execSubmodeId
;
176 @SuppressWarnings("nls")
177 public String
toString() {
178 return "[LttngExecutionState: " + "entry=" + entry_LttTime
+ ",change=" + change_LttTime
+ ",cum_cpu=" + cum_cpu_time_Timens
+
179 ",pstatus=" + proc_status
+ ",emode=" + exec_mode
+ ",esubmode=" + exec_submode
+"]";