• 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 { ChartStruct } from '../bean/FrameChartStruct';
17
18export class PerfFile {
19  path: string = '';
20  fileId: number = 0;
21  symbol: string = '';
22  fileName: string = '';
23
24  static setFileName(perfData: PerfFile): void {
25    if (perfData.path) {
26      let number = perfData.path.lastIndexOf('/');
27      if (number > 0) {
28        perfData.fileName = perfData.path.substring(number + 1);
29        return;
30      }
31    }
32    perfData.fileName = perfData.path;
33  }
34}
35
36export class PerfThread {
37  tid: number = 0;
38  pid: number = 0;
39  threadName: string = '';
40  processName: string = '';
41}
42
43export class PerfCall {
44  sampleId: number = 0;
45  depth: number = 0;
46  name: string = '';
47}
48
49export class PerfCallChain {
50  tid: number = 0;
51  pid: number = 0;
52  parentId: string = ''; //合并之后区分的id
53  id: string = '';
54  fileId: number = 0;
55  symbolId: number = 0;
56  topDownMerageId: string = ''; //top down合并使用的id
57  topDownMerageParentId: string = ''; //top down合并使用的id
58  bottomUpMerageId: string = ''; //bottom up合并使用的id
59  bottomUpMerageParentId: string = ''; //bottom up合并使用的id
60  sampleId: number = 0;
61  callChainId: number = 0;
62  name: string = '';
63  fileName: string = '';
64  threadState: string = '';
65  startNS: number = 0;
66  dur: number = 0;
67  vaddrInFile: number = 0;
68  path: string = '';
69  depth: number = 0;
70  canCharge: boolean = true;
71  previousNode: PerfCallChain | undefined = undefined; //将list转换为一个链表结构
72  nextNode: PerfCallChain | undefined = undefined;
73}
74
75export class PerfCallChainMerageData extends ChartStruct {
76  id: string = '';
77  parentId: string = '';
78  tid: number = 0;
79  pid: number = 0;
80  currentTreeParentNode: PerfCallChainMerageData | undefined = undefined;
81  libName: string = '';
82  symbol: string = '';
83  path: string = '';
84  self: string = '0s';
85  weight: string = '';
86  weightPercent: string = '';
87  selfDur: number = 0;
88  dur: number = 0;
89  children: PerfCallChainMerageData[] = [];
90  initChildren: PerfCallChainMerageData[] = [];
91  isStore = 0;
92  isSelected: boolean = false;
93  canCharge: boolean = true;
94  type: number = 0;
95  vaddrInFile: number = 0;
96  searchShow: boolean = true;
97}
98
99export class PerfSample {
100  sampleId: number = 0;
101  time: number = 0;
102  timeString: string = '';
103  core: number = 0;
104  coreName: string = '';
105  state: string = '';
106  pid: number = 0;
107  processName: string = '';
108  tid: number = 0;
109  threadName: string = '';
110  depth: number = 0;
111  addr: string = '';
112  fileId: number = 0;
113  symbolId: number = 0;
114  backtrace: Array<string> = [];
115}
116
117export class PerfStack {
118  symbol: string | number = 0;
119  symbolId: number = 0;
120  path: string = '';
121  fileId: number = 0;
122  type: number = 0;
123  vaddrInFile: number = 0;
124}
125
126export class PerfCmdLine {
127  report_value: string = '';
128}
129
130export class PerfLevelStruct {
131  processId?: number;
132  threadId?: number;
133  libId?: number;
134  libName?: number;
135  symbolId?: number;
136  symbolName?: string;
137}
138