• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 package ohos.devtools.views.applicationtrace.bean;
17 
18 import ohos.devtools.views.trace.AbstractNode;
19 import ohos.devtools.views.trace.DField;
20 import ohos.devtools.views.trace.util.Utils;
21 
22 import java.awt.Graphics2D;
23 import java.util.List;
24 
25 /**
26  * app function abstract class
27  *
28  * @since 2021/5/19 16:39
29  */
30 public abstract class AppFunc extends AbstractNode {
31     /**
32      * fun name
33      */
34     @DField(name = "funName")
35     protected String funcName = "";
36 
37     /**
38      * thread id
39      */
40     @DField(name = "tid")
41     protected Integer tid;
42 
43     /**
44      * depth
45      */
46     @DField(name = "depth")
47     protected Integer depth = 0;
48 
49     /**
50      * thread name
51      */
52     @DField(name = "threadName")
53     protected String threadName = "";
54 
55     /**
56      * start ts
57      */
58     @DField(name = "startTs")
59     protected long startTs;
60 
61     /**
62      * duration
63      */
64     @DField(name = "dur")
65     protected long dur;
66 
67     /**
68      * end ts
69      */
70     protected long endTs = 0L;
71 
72     /**
73      * blood id
74      */
75     protected String bloodId = "";
76 
77     /**
78      * parent blood id
79      */
80     protected String parentBloodId = "";
81 
82     /**
83      * Gets the value of funcName .
84      *
85      * @return the value of funcName .
86      */
getFuncName()87     public String getFuncName() {
88         return funcName;
89     }
90 
91     /**
92      * Sets the funcName .
93      * <p>You can use getFuncName() to get the value of funcName.</p>
94      *
95      * @param param .
96      */
setFuncName(final String param)97     public void setFuncName(final String param) {
98         this.funcName = param;
99     }
100 
101     /**
102      * Gets the value of tid .
103      *
104      * @return the value of tid .
105      */
getTid()106     public Integer getTid() {
107         return tid;
108     }
109 
110     /**
111      * Sets the tid .
112      * <p>You can use getTid() to get the value of tid.</p>
113      *
114      * @param param .
115      */
setTid(final Integer param)116     public void setTid(final Integer param) {
117         this.tid = param;
118     }
119 
120     /**
121      * Gets the value of depth .
122      *
123      * @return the value of depth .
124      */
getDepth()125     public Integer getDepth() {
126         return depth;
127     }
128 
129     /**
130      * Sets the depth .
131      * <p>You can use getDepth() to get the value of depth.</p>
132      *
133      * @param param .
134      */
setDepth(final Integer param)135     public void setDepth(final Integer param) {
136         this.depth = param;
137     }
138 
139     /**
140      * Gets the value of threadName .
141      *
142      * @return the value of threadName .
143      */
getThreadName()144     public String getThreadName() {
145         return threadName;
146     }
147 
148     /**
149      * Sets the threadName .
150      * <p>You can use getThreadName() to get the value of threadName.</p>
151      *
152      * @param param .
153      */
setThreadName(final String param)154     public void setThreadName(final String param) {
155         this.threadName = param;
156     }
157 
158     /**
159      * Gets the value of startTs .
160      *
161      * @return the value of startTs .
162      */
getStartTs()163     public long getStartTs() {
164         return startTs;
165     }
166 
167     /**
168      * Sets the startTs .
169      * <p>You can use getStartTs() to get the value of startTs.</p>
170      *
171      * @param param .
172      */
setStartTs(final long param)173     public void setStartTs(final long param) {
174         this.startTs = param;
175     }
176 
177     /**
178      * Gets the value of dur .
179      *
180      * @return the value of dur .
181      */
getDur()182     public long getDur() {
183         return dur;
184     }
185 
186     /**
187      * Sets the dur .
188      * <p>You can use getDur() to get the value of dur.</p>
189      *
190      * @param param .
191      */
setDur(final Long param)192     public void setDur(final Long param) {
193         this.dur = param;
194     }
195 
196     /**
197      * Gets the value of endTs .
198      *
199      * @return the value of endTs .
200      */
getEndTs()201     public long getEndTs() {
202         return endTs;
203     }
204 
205     /**
206      * Sets the endTs .
207      * <p>You can use getEndTs() to get the value of endTs.</p>
208      *
209      * @param param .
210      */
setEndTs(final long param)211     public void setEndTs(final long param) {
212         this.endTs = param;
213     }
214 
215     /**
216      * Gets the value of bloodId .
217      *
218      * @return the value of bloodId .
219      */
getBloodId()220     public String getBloodId() {
221         return bloodId;
222     }
223 
224     /**
225      * Sets the bloodId .
226      * <p>You can use getBloodId() to get the value of bloodId.</p>
227      *
228      * @param param .
229      */
setBloodId(final String param)230     public void setBloodId(final String param) {
231         this.bloodId = param;
232     }
233 
234     /**
235      * Gets the value of parentBloodId .
236      *
237      * @return the value of parentBloodId .
238      */
getParentBloodId()239     public String getParentBloodId() {
240         return parentBloodId;
241     }
242 
243     /**
244      * Sets the parentBloodId .
245      * <p>You can use getParentBloodId() to get the value of parentBloodId.</p>
246      *
247      * @param param .
248      */
setParentBloodId(final String param)249     public void setParentBloodId(final String param) {
250         this.parentBloodId = param;
251     }
252 
253     /**
254      * create StackId by parentStackId、funcName and depth
255      */
createBloodId()256     public void createBloodId() {
257         if (depth == 0) {
258             bloodId = Utils.md5String(threadName + funcName + depth);
259             parentBloodId = Utils.md5String(threadName);
260         } else {
261             bloodId = Utils.md5String(parentBloodId + funcName + depth);
262         }
263     }
264 
265     @Override
draw(Graphics2D paint)266     public void draw(Graphics2D paint) {
267     }
268 
269     @Override
getStringList(String time)270     public List<String> getStringList(String time) {
271         return null;
272     }
273 
274 }
275