1fb726d48Sopenharmony_ci/*
2fb726d48Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
3fb726d48Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4fb726d48Sopenharmony_ci * you may not use this file except in compliance with the License.
5fb726d48Sopenharmony_ci * You may obtain a copy of the License at
6fb726d48Sopenharmony_ci *
7fb726d48Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8fb726d48Sopenharmony_ci *
9fb726d48Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10fb726d48Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11fb726d48Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12fb726d48Sopenharmony_ci * See the License for the specific language governing permissions and
13fb726d48Sopenharmony_ci * limitations under the License.
14fb726d48Sopenharmony_ci */
15fb726d48Sopenharmony_ci
16fb726d48Sopenharmony_ciimport { ChartStruct } from '../bean/FrameChartStruct';
17fb726d48Sopenharmony_ci
18fb726d48Sopenharmony_ciexport class PerfFile {
19fb726d48Sopenharmony_ci  path: string = '';
20fb726d48Sopenharmony_ci  fileId: number = 0;
21fb726d48Sopenharmony_ci  symbol: string = '';
22fb726d48Sopenharmony_ci  fileName: string = '';
23fb726d48Sopenharmony_ci
24fb726d48Sopenharmony_ci  static setFileName(perfData: PerfFile): void {
25fb726d48Sopenharmony_ci    if (perfData.path) {
26fb726d48Sopenharmony_ci      let number = perfData.path.lastIndexOf('/');
27fb726d48Sopenharmony_ci      if (number > 0) {
28fb726d48Sopenharmony_ci        perfData.fileName = perfData.path.substring(number + 1);
29fb726d48Sopenharmony_ci        return;
30fb726d48Sopenharmony_ci      }
31fb726d48Sopenharmony_ci    }
32fb726d48Sopenharmony_ci    perfData.fileName = perfData.path;
33fb726d48Sopenharmony_ci  }
34fb726d48Sopenharmony_ci}
35fb726d48Sopenharmony_ci
36fb726d48Sopenharmony_ciexport class PerfThread {
37fb726d48Sopenharmony_ci  tid: number = 0;
38fb726d48Sopenharmony_ci  pid: number = 0;
39fb726d48Sopenharmony_ci  threadName: string = '';
40fb726d48Sopenharmony_ci  processName: string = '';
41fb726d48Sopenharmony_ci}
42fb726d48Sopenharmony_ci
43fb726d48Sopenharmony_ciexport class PerfCall {
44fb726d48Sopenharmony_ci  sampleId: number = 0;
45fb726d48Sopenharmony_ci  depth: number = 0;
46fb726d48Sopenharmony_ci  name: string = '';
47fb726d48Sopenharmony_ci}
48fb726d48Sopenharmony_ci
49fb726d48Sopenharmony_ciexport class PerfCallChain {
50fb726d48Sopenharmony_ci  tid: number = 0;
51fb726d48Sopenharmony_ci  pid: number = 0;
52fb726d48Sopenharmony_ci  parentId: string = ''; //合并之后区分的id
53fb726d48Sopenharmony_ci  id: string = '';
54fb726d48Sopenharmony_ci  fileId: number = 0;
55fb726d48Sopenharmony_ci  symbolId: number = 0;
56fb726d48Sopenharmony_ci  topDownMerageId: string = ''; //top down合并使用的id
57fb726d48Sopenharmony_ci  topDownMerageParentId: string = ''; //top down合并使用的id
58fb726d48Sopenharmony_ci  bottomUpMerageId: string = ''; //bottom up合并使用的id
59fb726d48Sopenharmony_ci  bottomUpMerageParentId: string = ''; //bottom up合并使用的id
60fb726d48Sopenharmony_ci  sampleId: number = 0;
61fb726d48Sopenharmony_ci  callChainId: number = 0;
62fb726d48Sopenharmony_ci  name: string = '';
63fb726d48Sopenharmony_ci  fileName: string = '';
64fb726d48Sopenharmony_ci  threadState: string = '';
65fb726d48Sopenharmony_ci  startNS: number = 0;
66fb726d48Sopenharmony_ci  dur: number = 0;
67fb726d48Sopenharmony_ci  vaddrInFile: number = 0;
68fb726d48Sopenharmony_ci  path: string = '';
69fb726d48Sopenharmony_ci  depth: number = 0;
70fb726d48Sopenharmony_ci  canCharge: boolean = true;
71fb726d48Sopenharmony_ci  previousNode: PerfCallChain | undefined = undefined; //将list转换为一个链表结构
72fb726d48Sopenharmony_ci  nextNode: PerfCallChain | undefined = undefined;
73fb726d48Sopenharmony_ci}
74fb726d48Sopenharmony_ci
75fb726d48Sopenharmony_ciexport class PerfCallChainMerageData extends ChartStruct {
76fb726d48Sopenharmony_ci  id: string = '';
77fb726d48Sopenharmony_ci  parentId: string = '';
78fb726d48Sopenharmony_ci  tid: number = 0;
79fb726d48Sopenharmony_ci  pid: number = 0;
80fb726d48Sopenharmony_ci  currentTreeParentNode: PerfCallChainMerageData | undefined = undefined;
81fb726d48Sopenharmony_ci  libName: string = '';
82fb726d48Sopenharmony_ci  symbol: string = '';
83fb726d48Sopenharmony_ci  path: string = '';
84fb726d48Sopenharmony_ci  self: string = '0s';
85fb726d48Sopenharmony_ci  weight: string = '';
86fb726d48Sopenharmony_ci  weightPercent: string = '';
87fb726d48Sopenharmony_ci  selfDur: number = 0;
88fb726d48Sopenharmony_ci  dur: number = 0;
89fb726d48Sopenharmony_ci  children: PerfCallChainMerageData[] = [];
90fb726d48Sopenharmony_ci  initChildren: PerfCallChainMerageData[] = [];
91fb726d48Sopenharmony_ci  isStore = 0;
92fb726d48Sopenharmony_ci  isSelected: boolean = false;
93fb726d48Sopenharmony_ci  canCharge: boolean = true;
94fb726d48Sopenharmony_ci  type: number = 0;
95fb726d48Sopenharmony_ci  vaddrInFile: number = 0;
96fb726d48Sopenharmony_ci  searchShow: boolean = true;
97fb726d48Sopenharmony_ci}
98fb726d48Sopenharmony_ci
99fb726d48Sopenharmony_ciexport class PerfSample {
100fb726d48Sopenharmony_ci  sampleId: number = 0;
101fb726d48Sopenharmony_ci  time: number = 0;
102fb726d48Sopenharmony_ci  timeString: string = '';
103fb726d48Sopenharmony_ci  core: number = 0;
104fb726d48Sopenharmony_ci  coreName: string = '';
105fb726d48Sopenharmony_ci  state: string = '';
106fb726d48Sopenharmony_ci  pid: number = 0;
107fb726d48Sopenharmony_ci  processName: string = '';
108fb726d48Sopenharmony_ci  tid: number = 0;
109fb726d48Sopenharmony_ci  threadName: string = '';
110fb726d48Sopenharmony_ci  depth: number = 0;
111fb726d48Sopenharmony_ci  addr: string = '';
112fb726d48Sopenharmony_ci  fileId: number = 0;
113fb726d48Sopenharmony_ci  symbolId: number = 0;
114fb726d48Sopenharmony_ci  backtrace: Array<string> = [];
115fb726d48Sopenharmony_ci}
116fb726d48Sopenharmony_ci
117fb726d48Sopenharmony_ciexport class PerfStack {
118fb726d48Sopenharmony_ci  symbol: string | number = 0;
119fb726d48Sopenharmony_ci  symbolId: number = 0;
120fb726d48Sopenharmony_ci  path: string = '';
121fb726d48Sopenharmony_ci  fileId: number = 0;
122fb726d48Sopenharmony_ci  type: number = 0;
123fb726d48Sopenharmony_ci  vaddrInFile: number = 0;
124fb726d48Sopenharmony_ci}
125fb726d48Sopenharmony_ci
126fb726d48Sopenharmony_ciexport class PerfCmdLine {
127fb726d48Sopenharmony_ci  report_value: string = '';
128fb726d48Sopenharmony_ci}
129fb726d48Sopenharmony_ci
130fb726d48Sopenharmony_ciexport class PerfLevelStruct {
131fb726d48Sopenharmony_ci  processId?: number;
132fb726d48Sopenharmony_ci  threadId?: number;
133fb726d48Sopenharmony_ci  libId?: number;
134fb726d48Sopenharmony_ci  libName?: number;
135fb726d48Sopenharmony_ci  symbolId?: number;
136fb726d48Sopenharmony_ci  symbolName?: string;
137fb726d48Sopenharmony_ci}
138