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 */
15export class Smaps {
16  startNs: number = -1;
17  startAddr: string = '';
18  endAddr: string = '';
19  address: string = '';
20  permission: string = '';
21  type: SmapsType = 0;
22  typeName: string = '';
23  path: string = '';
24  size: number = 0;
25  sizeStr: string = '';
26  count: number = 0;
27  rss: number = 0;
28  rssStr: string = '';
29  pss: number = 0;
30  pssStr: string = '';
31  sharedClean: number = 0;
32  sharedDirty: number = 0;
33  privateClean: number = 0;
34  privateDirty: number = 0;
35  swap: number = 0;
36  swapPss: number = 0;
37  resideStr: string = '';
38}
39export class SmapsTreeObj {
40  constructor(id: string, pid: string, type: string) {
41    this.id = id;
42    this.pid = pid;
43    this.typeName = type;
44  }
45  id: string = '';
46  pid: string = '';
47  typeName: string = '';
48  path: unknown = '';
49  size: number = 0;
50  sizeStr: string = '';
51  sizePro: number = 0;
52  sizeProStr: string = '';
53  count: number = 0;
54  rss: number = 0;
55  rssStr: string = '';
56  pss: number = 0;
57  pssStr: string = '';
58  sharedClean: number = 0;
59  sharedCleanStr: string = '';
60  sharedDirty: number = 0;
61  sharedDirtyStr: string = '';
62  privateClean: number = 0;
63  privateCleanStr: string = '';
64  privateDirty: number = 0;
65  privateDirtyStr: string = '';
66  swap: number = 0;
67  swapStr: string = '';
68  swapPss: number = 0;
69  swapPssStr: string = '';
70  children: Array<SmapsTreeObj> = [];
71}
72export enum SmapsType {
73  TYPE_CODE_SYS,
74  TYPE_CODE_APP,
75  TYPE_DATA_SYS,
76  TYPE_DATA_APP,
77  TYPE_UNKNOWN_ANON,
78  TYPE_STACK,
79  TYPE_JS_HEAP,
80  TYPE_JAVA_VM,
81  TYPE_NATIVE_HEAP,
82  TYPE_ASHMEM,
83  TYPE_OTHER_SYS,
84  TYPE_OTHER_APP,
85}
86export const TYPE_STRING = [
87  'CODE_SYS',
88  'CODE_APP',
89  'DATA_SYS',
90  'DATA_APP',
91  'UNKNOWN_ANON',
92  'STACK',
93  'JS_HEAP',
94  'JAVA_VM',
95  'NATIVE_HEAP',
96  'ASHMEM',
97  'OTHER_SYS',
98  'OTHER_APP',
99];
100