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