Commit | Line | Data |
---|---|---|
5d10d135 ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009 Ericsson | |
3 | * | |
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 | |
8 | * | |
9 | * Contributors: | |
10 | * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | package org.eclipse.linuxtools.lttng.state.model; | |
13 | ||
14 | import org.eclipse.linuxtools.lttng.state.StateStrings; | |
15 | ||
16 | /** | |
17 | * <b><u>LttngExecutionState</u></b> | |
18 | * <p> | |
19 | * | |
20 | */ | |
21 | public class LttngExecutionState implements Cloneable { | |
22 | // ======================================================================== | |
23 | // Data | |
24 | // ======================================================================= | |
28b94d61 FC |
25 | private Long entry_LttTime = null; |
26 | private Long change_LttTime = null; | |
5d10d135 ASL |
27 | private Long cum_cpu_time_Timens = null; |
28 | ||
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(); | |
32 | ||
cc6eec3e FC |
33 | @Override |
34 | public LttngExecutionState clone() { | |
5d10d135 ASL |
35 | LttngExecutionState newState = null; |
36 | ||
37 | try { | |
38 | newState = (LttngExecutionState)super.clone(); | |
39 | ||
40 | // *** IMPORTANT *** | |
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; | |
46 | ||
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; | |
28b94d61 FC |
50 | newState.entry_LttTime = this.entry_LttTime; |
51 | newState.change_LttTime = this.change_LttTime; | |
5d10d135 ASL |
52 | } |
53 | catch ( CloneNotSupportedException e ) { | |
54 | System.out.println("Cloning failed with : " + e.getMessage() ); | |
55 | } | |
56 | ||
57 | return newState; | |
58 | } | |
59 | ||
60 | // ======================================================================== | |
61 | // Methods | |
62 | // ======================================================================= | |
63 | /** | |
64 | * @return the entry_LttTime | |
65 | */ | |
28b94d61 | 66 | public Long getEntry_LttTime() { |
5d10d135 ASL |
67 | return entry_LttTime; |
68 | } | |
69 | ||
70 | /** | |
71 | * @param entryLttTime | |
72 | * the entry_LttTime to set | |
73 | */ | |
28b94d61 | 74 | public void setEntry_Time(Long entryLttTime) { |
5d10d135 ASL |
75 | entry_LttTime = entryLttTime; |
76 | } | |
77 | ||
78 | /** | |
79 | * @return the change_LttTime | |
80 | */ | |
28b94d61 | 81 | public Long getChange_LttTime() { |
5d10d135 ASL |
82 | return change_LttTime; |
83 | } | |
84 | ||
85 | /** | |
86 | * @param changeLttTime | |
87 | * the change_LttTime to set | |
88 | */ | |
28b94d61 | 89 | public void setChange_Time(Long changeLttTime) { |
5d10d135 ASL |
90 | change_LttTime = changeLttTime; |
91 | } | |
92 | ||
93 | /** | |
94 | * @return the cum_cpu_time_LttTime | |
95 | */ | |
96 | public Long getCum_cpu_time() { | |
97 | return cum_cpu_time_Timens; | |
98 | } | |
99 | ||
100 | /** | |
101 | * @param cumCpuTimeLttTime | |
102 | * the cum_cpu_time_LttTime to set | |
103 | */ | |
104 | public void setCum_cpu_time(Long cumCpuTime) { | |
105 | cum_cpu_time_Timens = cumCpuTime; | |
106 | } | |
107 | ||
108 | /** | |
109 | * @return the proc_status | |
110 | */ | |
111 | public StateStrings.ProcessStatus getProc_status() { | |
112 | return proc_status; | |
113 | } | |
114 | ||
115 | /** | |
116 | * @param procStatus | |
117 | * the proc_status to set | |
118 | */ | |
119 | public void setProc_status(StateStrings.ProcessStatus procStatus) { | |
120 | proc_status = procStatus; | |
121 | } | |
122 | ||
123 | /** | |
124 | * @return the exec_mode | |
125 | */ | |
126 | public StateStrings.ExecutionMode getExec_mode() { | |
127 | return exec_mode; | |
128 | } | |
129 | ||
130 | /** | |
131 | * @param execMode | |
132 | * the exec_mode to set | |
133 | */ | |
134 | public void setExec_mode(StateStrings.ExecutionMode execMode) { | |
135 | exec_mode = execMode; | |
136 | } | |
137 | ||
138 | /** | |
139 | * @return the exec_submode | |
140 | */ | |
141 | public String getExec_submode() { | |
142 | return exec_submode; | |
143 | } | |
144 | ||
145 | /** | |
146 | * @param execSubmode | |
147 | * the exec_submode to set | |
148 | */ | |
149 | public void setExec_submode(String execSubmode) { | |
150 | exec_submode = execSubmode; | |
151 | } | |
0c2a2e08 FC |
152 | |
153 | @Override | |
154 | public String toString() { | |
155 | return "[LttngExecutionState: " + "entry=" + entry_LttTime + ",change=" + change_LttTime + ",cum_cpu=" + cum_cpu_time_Timens + | |
156 | ",pstatus=" + proc_status + ",emode=" + exec_mode + ",esubmode=" + exec_submode +"]"; | |
157 | } | |
5d10d135 | 158 | } |