• 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): void {
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  pid: string | undefined;
141  symbolId: number = 0;
142  count: number = 0;
143  countValue: string = '';
144  countPercent: string = '';
145  type: number = 0;
146  heapSize: number = 0;
147  heapPercent: string = '';
148  heapSizeStr: string = '';
149  eventId: number = 0;
150  threadId: number = 0;
151  threadName: string = '';
152  isSelected: boolean = false;
153}
154
155export class NativeEvent {
156  startTime: number = 0;
157  heapSize: number = 0;
158  eventType: string = '';
159}
160
161export class NativeMemoryExpression {
162  includeLib: Map<string, string[]> = new Map<string, string[]>();
163  abandonLib: Map<string, string[]> = new Map<string, string[]>();
164}
165
166export class FilterByAnalysis {
167  symbolId?: number;
168  symbolName?: string;
169  libId?: number;
170  libName?: string;
171  tid?: number;
172  tName?: string;
173  type?: string;
174  typeId?: number;
175
176  constructor(
177    typeId: number | undefined,
178    type: string | undefined,
179    tName: string | undefined,
180    tid: number | undefined,
181    libId: number | undefined,
182    libName: string | undefined,
183    symbolId: number | undefined,
184    symbolName: string | undefined
185  ) {
186    this.typeId = typeId;
187    this.libId = libId || -1;
188    this.libName = libName;
189    this.tid = tid;
190    this.tName = tName;
191    this.symbolId = symbolId;
192    this.symbolName = symbolName;
193    this.type = type;
194  }
195}
196