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 { Utils } from '../component/trace/base/Utils';
17fb726d48Sopenharmony_ciimport { ChartStruct } from '../bean/FrameChartStruct';
18fb726d48Sopenharmony_ci
19fb726d48Sopenharmony_ciexport class NativeHookStatistics {
20fb726d48Sopenharmony_ci  eventId: number = 0;
21fb726d48Sopenharmony_ci  eventType: string = '';
22fb726d48Sopenharmony_ci  subType: string = '';
23fb726d48Sopenharmony_ci  subTypeId: number = 0;
24fb726d48Sopenharmony_ci  heapSize: number = 0;
25fb726d48Sopenharmony_ci  addr: string = '';
26fb726d48Sopenharmony_ci  startTs: number = 0;
27fb726d48Sopenharmony_ci  endTs: number = 0;
28fb726d48Sopenharmony_ci  sumHeapSize: number = 0;
29fb726d48Sopenharmony_ci  max: number = 0;
30fb726d48Sopenharmony_ci  count: number = 0;
31fb726d48Sopenharmony_ci  tid: number = 0;
32fb726d48Sopenharmony_ci  threadName: string = '';
33fb726d48Sopenharmony_ci  isSelected: boolean = false;
34fb726d48Sopenharmony_ci}
35fb726d48Sopenharmony_ci
36fb726d48Sopenharmony_ciexport class NativeHookMalloc {
37fb726d48Sopenharmony_ci  eventType: string = '';
38fb726d48Sopenharmony_ci  subType: string = '';
39fb726d48Sopenharmony_ci  subTypeId: number = 0;
40fb726d48Sopenharmony_ci  heapSize: number = 0;
41fb726d48Sopenharmony_ci  allocByte: number = 0;
42fb726d48Sopenharmony_ci  allocCount: number = 0;
43fb726d48Sopenharmony_ci  freeByte: number = 0;
44fb726d48Sopenharmony_ci  freeCount: number = 0;
45fb726d48Sopenharmony_ci  max: number = 0;
46fb726d48Sopenharmony_ci}
47fb726d48Sopenharmony_ci
48fb726d48Sopenharmony_ciexport class NativeEventHeap {
49fb726d48Sopenharmony_ci  eventType: string = '';
50fb726d48Sopenharmony_ci  sumHeapSize: number = 0;
51fb726d48Sopenharmony_ci}
52fb726d48Sopenharmony_ci
53fb726d48Sopenharmony_ciexport class NativeHookProcess {
54fb726d48Sopenharmony_ci  ipid: number = 0;
55fb726d48Sopenharmony_ci  pid: number = 0;
56fb726d48Sopenharmony_ci  name: String = '';
57fb726d48Sopenharmony_ci}
58fb726d48Sopenharmony_ci
59fb726d48Sopenharmony_ciexport class NativeHookStatisticsTableData {
60fb726d48Sopenharmony_ci  memoryTap: string = '';
61fb726d48Sopenharmony_ci  existing: number = 0;
62fb726d48Sopenharmony_ci  existingString: string = '';
63fb726d48Sopenharmony_ci  freeByteString: string = '';
64fb726d48Sopenharmony_ci  allocCount: number = 0;
65fb726d48Sopenharmony_ci  freeCount: number = 0;
66fb726d48Sopenharmony_ci  freeByte: number = 0;
67fb726d48Sopenharmony_ci  totalBytes: number = 0;
68fb726d48Sopenharmony_ci  totalBytesString: string = '';
69fb726d48Sopenharmony_ci  maxStr: string = '';
70fb726d48Sopenharmony_ci  max: number = 0;
71fb726d48Sopenharmony_ci  totalCount: number = 0;
72fb726d48Sopenharmony_ci  existingValue: Array<number> = [];
73fb726d48Sopenharmony_ci}
74fb726d48Sopenharmony_ci
75fb726d48Sopenharmony_ciexport class NativeMemory {
76fb726d48Sopenharmony_ci  index: number = 0;
77fb726d48Sopenharmony_ci  eventId: number = 0;
78fb726d48Sopenharmony_ci  threadId: number = 0;
79fb726d48Sopenharmony_ci  threadName: string = '';
80fb726d48Sopenharmony_ci  eventType: string = '';
81fb726d48Sopenharmony_ci  subType: string = '';
82fb726d48Sopenharmony_ci  startTs: number = 0;
83fb726d48Sopenharmony_ci  endTs: number = 0;
84fb726d48Sopenharmony_ci  timestamp: string = '';
85fb726d48Sopenharmony_ci  heapSize: number = 0;
86fb726d48Sopenharmony_ci  heapSizeUnit: string = '';
87fb726d48Sopenharmony_ci  symbol: string = '';
88fb726d48Sopenharmony_ci  library: string = '';
89fb726d48Sopenharmony_ci  isSelected: boolean = false;
90fb726d48Sopenharmony_ci  state: string = '';
91fb726d48Sopenharmony_ci  addr: string = '';
92fb726d48Sopenharmony_ci}
93fb726d48Sopenharmony_ci
94fb726d48Sopenharmony_ciexport class NativeHookSamplerInfo {
95fb726d48Sopenharmony_ci  current: string = '';
96fb726d48Sopenharmony_ci  currentSize: number = 0;
97fb726d48Sopenharmony_ci  startTs: number = 0;
98fb726d48Sopenharmony_ci  heapSize: number = 0;
99fb726d48Sopenharmony_ci  snapshot: string = '';
100fb726d48Sopenharmony_ci  growth: string = '';
101fb726d48Sopenharmony_ci  total: number = 0;
102fb726d48Sopenharmony_ci  totalGrowth: string = '';
103fb726d48Sopenharmony_ci  existing: number = 0;
104fb726d48Sopenharmony_ci  children: Array<NativeHookSamplerInfo> = [];
105fb726d48Sopenharmony_ci  tempList: Array<NativeHookSamplerInfo> = [];
106fb726d48Sopenharmony_ci  timestamp: string = '';
107fb726d48Sopenharmony_ci  eventId: number = -1;
108fb726d48Sopenharmony_ci  threadId: number = 0;
109fb726d48Sopenharmony_ci  threadName: string = '';
110fb726d48Sopenharmony_ci
111fb726d48Sopenharmony_ci  merageObj(merageObj: NativeHookSamplerInfo): void {
112fb726d48Sopenharmony_ci    this.currentSize += merageObj.currentSize;
113fb726d48Sopenharmony_ci    this.heapSize += merageObj.heapSize;
114fb726d48Sopenharmony_ci    this.existing += merageObj.existing;
115fb726d48Sopenharmony_ci    this.total += merageObj.total;
116fb726d48Sopenharmony_ci    this.growth = Utils.getByteWithUnit(this.heapSize);
117fb726d48Sopenharmony_ci    this.current = Utils.getByteWithUnit(this.currentSize);
118fb726d48Sopenharmony_ci    this.totalGrowth = Utils.getByteWithUnit(this.total);
119fb726d48Sopenharmony_ci  }
120fb726d48Sopenharmony_ci}
121fb726d48Sopenharmony_ci
122fb726d48Sopenharmony_ciexport class NativeHookSampleQueryInfo {
123fb726d48Sopenharmony_ci  eventId: number = -1;
124fb726d48Sopenharmony_ci  current: number = 0;
125fb726d48Sopenharmony_ci  eventType: string = '';
126fb726d48Sopenharmony_ci  subType: string = '';
127fb726d48Sopenharmony_ci  subTypeId: number = 0;
128fb726d48Sopenharmony_ci  growth: number = 0;
129fb726d48Sopenharmony_ci  existing: number = 0;
130fb726d48Sopenharmony_ci  addr: string = '';
131fb726d48Sopenharmony_ci  startTs: number = 0;
132fb726d48Sopenharmony_ci  endTs: number = 0;
133fb726d48Sopenharmony_ci  total: number = 0;
134fb726d48Sopenharmony_ci  threadId: number = 0;
135fb726d48Sopenharmony_ci  threadName: string = '';
136fb726d48Sopenharmony_ci  children: Array<NativeHookSamplerInfo> = [];
137fb726d48Sopenharmony_ci}
138fb726d48Sopenharmony_ci
139fb726d48Sopenharmony_ciexport class NativeHookCallInfo extends ChartStruct {
140fb726d48Sopenharmony_ci  pid: string | undefined;
141fb726d48Sopenharmony_ci  symbolId: number = 0;
142fb726d48Sopenharmony_ci  count: number = 0;
143fb726d48Sopenharmony_ci  countValue: string = '';
144fb726d48Sopenharmony_ci  countPercent: string = '';
145fb726d48Sopenharmony_ci  type: number = 0;
146fb726d48Sopenharmony_ci  heapSize: number = 0;
147fb726d48Sopenharmony_ci  heapPercent: string = '';
148fb726d48Sopenharmony_ci  heapSizeStr: string = '';
149fb726d48Sopenharmony_ci  eventId: number = 0;
150fb726d48Sopenharmony_ci  threadId: number = 0;
151fb726d48Sopenharmony_ci  threadName: string = '';
152fb726d48Sopenharmony_ci  isSelected: boolean = false;
153fb726d48Sopenharmony_ci}
154fb726d48Sopenharmony_ci
155fb726d48Sopenharmony_ciexport class NativeEvent {
156fb726d48Sopenharmony_ci  startTime: number = 0;
157fb726d48Sopenharmony_ci  heapSize: number = 0;
158fb726d48Sopenharmony_ci  eventType: string = '';
159fb726d48Sopenharmony_ci}
160fb726d48Sopenharmony_ci
161fb726d48Sopenharmony_ciexport class NativeMemoryExpression {
162fb726d48Sopenharmony_ci  includeLib: Map<string, string[]> = new Map<string, string[]>();
163fb726d48Sopenharmony_ci  abandonLib: Map<string, string[]> = new Map<string, string[]>();
164fb726d48Sopenharmony_ci}
165fb726d48Sopenharmony_ci
166fb726d48Sopenharmony_ciexport class FilterByAnalysis {
167fb726d48Sopenharmony_ci  symbolId?: number;
168fb726d48Sopenharmony_ci  symbolName?: string;
169fb726d48Sopenharmony_ci  libId?: number;
170fb726d48Sopenharmony_ci  libName?: string;
171fb726d48Sopenharmony_ci  tid?: number;
172fb726d48Sopenharmony_ci  tName?: string;
173fb726d48Sopenharmony_ci  type?: string;
174fb726d48Sopenharmony_ci  typeId?: number;
175fb726d48Sopenharmony_ci
176fb726d48Sopenharmony_ci  constructor(
177fb726d48Sopenharmony_ci    typeId: number | undefined,
178fb726d48Sopenharmony_ci    type: string | undefined,
179fb726d48Sopenharmony_ci    tName: string | undefined,
180fb726d48Sopenharmony_ci    tid: number | undefined,
181fb726d48Sopenharmony_ci    libId: number | undefined,
182fb726d48Sopenharmony_ci    libName: string | undefined,
183fb726d48Sopenharmony_ci    symbolId: number | undefined,
184fb726d48Sopenharmony_ci    symbolName: string | undefined
185fb726d48Sopenharmony_ci  ) {
186fb726d48Sopenharmony_ci    this.typeId = typeId;
187fb726d48Sopenharmony_ci    this.libId = libId || -1;
188fb726d48Sopenharmony_ci    this.libName = libName;
189fb726d48Sopenharmony_ci    this.tid = tid;
190fb726d48Sopenharmony_ci    this.tName = tName;
191fb726d48Sopenharmony_ci    this.symbolId = symbolId;
192fb726d48Sopenharmony_ci    this.symbolName = symbolName;
193fb726d48Sopenharmony_ci    this.type = type;
194fb726d48Sopenharmony_ci  }
195fb726d48Sopenharmony_ci}
196