1/*
2 * Copyright (C) 2022 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
16const ROW_TYPE = 'hiperf';
17
18export class PerfFireChartStruct {
19  thread_id: number;
20  name: string;
21  depth: number;
22  selfTime: number;
23  totalTime: number;
24  id: number;
25
26  constructor(id: number, name: string, depth: number, selfTime: number, totalTime: number, thread_id: number) {
27    this.id = id;
28    this.name = name;
29    this.depth = depth;
30    this.selfTime = selfTime;
31    this.totalTime = totalTime;
32    this.thread_id = thread_id;
33  }
34}
35
36// 绘图所需树结构模板
37export class HiPerfChartFrame extends PerfFireChartStruct {
38  startTime: number;
39  endTime: number;
40  children: Array<HiPerfChartFrame>;
41  isSelect: boolean = false;
42  line: number = 0;
43  column: number = 0;
44  thread_id: number = 0;
45
46  constructor(
47    id: number,
48    name: string,
49    startTime: number,
50    endTime: number,
51    totalTime: number,
52    depth: number,
53    thread_id: number
54  ) {
55    super(id, name, depth, 0, totalTime, thread_id);
56    this.id = id;
57    this.startTime = startTime;
58    this.endTime = endTime;
59    this.thread_id = thread_id;
60    this.children = new Array<HiPerfChartFrame>();
61  }
62}
63