• 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 { FuncStruct } from '../database/ui-worker/ProcedureWorkerFunc';
17import { FrameDynamicStruct } from '../database/ui-worker/ProcedureWorkerFrameDynamic';
18import { FrameAnimationStruct } from '../database/ui-worker/ProcedureWorkerFrameAnimation';
19import { FrameSpacingStruct } from '../database/ui-worker/ProcedureWorkerFrameSpacing';
20import { JsCpuProfilerChartFrame } from './JsStruct';
21import { LogStruct } from '../database/ui-worker/ProcedureWorkerLog';
22import { HiSysEventStruct } from '../database/ui-worker/ProcedureWorkerHiSysEvent';
23import { RangeSelectStruct, TraceRow } from '../component/trace/base/TraceRow';
24import { info } from '../../log/Log';
25import { SpSystemTrace } from '../component/SpSystemTrace';
26import { intersectData, isExistPidInArray, setSelectState } from '../component/Utils';
27import { TabPaneTaskFrames } from '../component/trace/sheet/task/TabPaneTaskFrames';
28import { JanksStruct } from './JanksStruct';
29import { HeapDataInterface } from '../../js-heap/HeapDataInterface';
30import { LitTabs } from '../../base-ui/tabs/lit-tabs';
31import { TabPaneSummary } from '../component/trace/sheet/ark-ts/TabPaneSummary';
32import { JsCpuProfilerStruct } from '../database/ui-worker/ProcedureWorkerCpuProfiler';
33import { SampleStruct } from '../database/ui-worker/ProcedureWorkerBpftrace';
34import { GpuCounterStruct } from '../database/ui-worker/ProcedureWorkerGpuCounter';
35
36export class SelectionParam {
37  traceId: string | undefined | null;
38  recordStartNs: number = 0;
39  leftNs: number = 0;
40  rightNs: number = 0;
41  hasFps: boolean = false;
42  statisticsSelectData: unknown = undefined;
43  fileSystemVMData: unknown = undefined;
44  fileSystemIoData: unknown = undefined;
45  fileSystemFsData: unknown = undefined;
46  perfAll: boolean = false;
47  fileSysVirtualMemory: boolean = false;
48  diskIOLatency: boolean = false;
49  fsCount: number = 0;
50  vmCount: number = 0;
51  isCurrentPane: boolean = false;
52  startup: boolean = false;
53  staticInit: boolean = false;
54  isRowClick: boolean = false;
55  eventTypeId: string = '';
56  cpus: Array<number> = [];
57  cpuStateRowsId: Array<object> = [];
58  //新增框选cpu freq row名
59  cpuFreqFilterNames: Array<string> = [];
60  cpuStateFilterIds: Array<number> = [];
61  cpuFreqFilterIds: Array<number> = [];
62  threadIds: Array<number> = [];
63  processIds: Array<number> = [];
64  processTrackIds: Array<number> = [];
65  virtualTrackIds: Array<number> = [];
66  cpuFreqLimit: Array<unknown> = [];
67  clockMapData: Map<string, ((arg: unknown) => Promise<Array<unknown>> | undefined) | undefined> = new Map<
68    string,
69    ((arg: unknown) => Promise<Array<unknown>> | undefined) | undefined
70  >();
71  dmaFenceNameData: Array<String> = [];//新增框选dma_fence数据
72  hangMapData: Map<string, ((arg: unknown) => Promise<Array<unknown>> | undefined) | undefined> = new Map();
73  irqCallIds: Array<number> = [];
74  softIrqCallIds: Array<number> = [];
75  funTids: Array<number> = [];
76  funAsync: Array<{ name: string; pid: number }> = [];
77  funCatAsync: Array<{ pid: number; threadName: string }> = [];
78  nativeMemory: Array<String> = [];
79  nativeMemoryStatistic: Array<String> = [];
80  nativeMemoryAllProcess: Array<{ pid: number; ipid: number }> = [];
81  nativeMemoryCurrentIPid: number = -1;
82  cpuAbilityIds: Array<string> = [];
83  memoryAbilityIds: Array<string> = [];
84  diskAbilityIds: Array<string> = [];
85  networkAbilityIds: Array<string> = [];
86  perfSampleIds: Array<number> = [];
87  perfEventTypeId?: number;
88  perfCpus: Array<number> = [];
89  perfProcess: Array<number> = [];
90  perfThread: Array<number> = [];
91  fileSystemType: Array<number> = [];
92  sdkCounterIds: Array<string> = [];
93  sdkSliceIds: Array<string> = [];
94  diskIOipids: Array<number> = [];
95  diskIOReadIds: Array<number> = [];
96  diskIOWriteIds: Array<number> = [];
97  systemEnergy: Array<string> = [];
98  powerEnergy: Array<string> = [];
99  anomalyEnergy: Array<string> = [];
100  smapsType: Array<string> = [];
101  vmtrackershm: Array<string> = [];
102  promiseList: Array<Promise<unknown>> = [];
103  jankFramesData: Array<unknown> = [];
104  jsMemory: Array<unknown> = [];
105  taskFramesData: Array<FuncStruct> = [];
106  frameDynamic: Array<FrameDynamicStruct> = [];
107  frameAnimation: Array<FrameAnimationStruct> = [];
108  frameSpacing: Array<FrameSpacingStruct> = [];
109  jsCpuProfilerData: Array<JsCpuProfilerChartFrame> = [];
110  gpu: {
111    gl: boolean;
112    graph: boolean;
113    gpuTotal: boolean;
114    gpuWindow: boolean;
115  } = {
116      gl: false,
117      graph: false,
118      gpuWindow: false,
119      gpuTotal: false,
120    };
121  purgeableTotalAbility: Array<unknown> = [];
122  purgeableTotalVM: Array<unknown> = [];
123  purgeablePinAbility: Array<unknown> = [];
124  purgeablePinVM: Array<unknown> = [];
125  purgeableTotalSelection: Array<unknown> = [];
126  purgeablePinSelection: Array<unknown> = [];
127  dmaAbilityData: Array<unknown> = [];
128  gpuMemoryAbilityData: Array<unknown> = [];
129  dmaVmTrackerData: Array<unknown> = [];
130  gpuMemoryTrackerData: Array<unknown> = [];
131  hiLogs: Array<string> = [];
132  sysAllEventsData: Array<HiSysEventStruct> = [];
133  sysAlllogsData: Array<LogStruct> = [];
134  hiSysEvents: Array<string> = [];
135  sampleData: Array<unknown> = [];
136  gpuCounter: Array<unknown> = [];
137
138  // @ts-ignore
139  pushSampleData(it: TraceRow<unknown>): void {
140    if (it.rowType === TraceRow.ROW_TYPE_SAMPLE) {
141      let dataList: SampleStruct[] = JSON.parse(JSON.stringify(it.dataList));
142      if (dataList.length > 0) {
143        dataList.forEach((SampleStruct) => {
144          SampleStruct.property = SampleStruct.property!.filter(
145            (i: unknown) =>
146              // @ts-ignore
147              (i.begin! - i.startTs! ?? 0) >= TraceRow.rangeSelectObject!.startNS! &&
148              // @ts-ignore
149              (i.end! - i.startTs! ?? 0) <= TraceRow.rangeSelectObject!.endNS!
150          );
151        });
152        if (dataList[0].property!.length !== 0) {
153          this.sampleData.push(...dataList);
154        }
155      }
156    }
157  }
158
159  // @ts-ignore
160  pushCpus(it: TraceRow<unknown>): void {
161    if (it.rowType === TraceRow.ROW_TYPE_CPU) {
162      this.cpus.push(parseInt(it.rowId!));
163      info('load CPU traceRow id is : ', it.rowId);
164    }
165  }
166
167  // @ts-ignore
168  pushCpuStateFilterIds(it: TraceRow<unknown>): void {
169    if (it.rowType === TraceRow.ROW_TYPE_CPU_STATE_ALL) {
170      it.childrenList.forEach((child) => {
171        child.rangeSelect = true;
172        child.checkType = '2';
173        this.pushCpuStateFilterIds(child);
174      });
175    }
176    if (it.rowType === TraceRow.ROW_TYPE_CPU_STATE) {
177      let filterId = parseInt(it.rowId!);
178      if (this.cpuStateFilterIds.indexOf(filterId) === -1) {
179        this.cpuStateFilterIds.push(filterId);
180      }
181    }
182  }
183
184  // @ts-ignore
185  pushCpuFreqFilter(it: TraceRow<unknown>): void {
186    if (it.rowType === TraceRow.ROW_TYPE_CPU_FREQ_ALL) {
187      it.childrenList.forEach((child) => {
188        child.rangeSelect = true;
189        child.checkType = '2';
190        this.pushCpuFreqFilter(child);
191      });
192    }
193    if (it.rowType === TraceRow.ROW_TYPE_CPU_FREQ) {
194      let filterId = parseInt(it.rowId!);
195      let filterName = it.name!;
196      if (this.cpuFreqFilterIds.indexOf(filterId) === -1) {
197        this.cpuFreqFilterIds.push(filterId);
198      }
199      if (this.cpuFreqFilterNames.indexOf(filterName) === -1) {
200        this.cpuFreqFilterNames.push(filterName);
201      }
202    }
203  }
204
205  // @ts-ignore
206  pushCpuFreqLimit(it: TraceRow<unknown>): void {
207    if (it.rowType === TraceRow.ROW_TYPE_CPU_FREQ_LIMITALL) {
208      it.childrenList.forEach((child) => {
209        child.rangeSelect = true;
210        child.checkType = '2';
211        this.pushCpuFreqLimit(child);
212      });
213    }
214    if (it.rowType === TraceRow.ROW_TYPE_CPU_FREQ_LIMIT) {
215      // @ts-ignore
216      if (!this.cpuFreqLimit.includes((item: unknown) => item.cpu === it.getAttribute('cpu'))) {
217        this.cpuFreqLimit.push({
218          maxFilterId: it.getAttribute('maxFilterId'),
219          minFilterId: it.getAttribute('minFilterId'),
220          cpu: it.getAttribute('cpu'),
221        });
222      }
223    }
224  }
225
226  // @ts-ignore
227  pushProcess(it: TraceRow<unknown>, sp: SpSystemTrace): void {
228    if (it.rowType === TraceRow.ROW_TYPE_PROCESS) {
229      sp.pushPidToSelection(this, it.rowId!);
230      if (it.getAttribute('hasStartup') === 'true') {
231        this.startup = true;
232      }
233      if (it.getAttribute('hasStaticInit') === 'true') {
234        this.staticInit = true;
235      }
236      // @ts-ignore
237      let processChildRows: Array<TraceRow<unknown>> = [
238        // @ts-ignore
239        ...sp.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`trace-row[row-parent-id='${it.rowId}']`),
240      ];
241      if (!it.expansion) {
242        processChildRows = [...it.childrenList];
243      }
244      processChildRows.forEach((th) => {
245        th.rangeSelect = true;
246        th.checkType = '2';
247        if (th.rowType === TraceRow.ROW_TYPE_THREAD) {
248          this.threadIds.push(parseInt(th.rowId!));
249        } else if (th.rowType === TraceRow.ROW_TYPE_FUNC) {
250          if (th.asyncFuncName) {
251            if (typeof th.asyncFuncName === 'string') {
252              this.funAsync.push({
253                name: th.asyncFuncName,
254                pid: th.asyncFuncNamePID || 0,
255              });
256            } else {
257              for (let i = 0; i < th.asyncFuncName.length; i++) {
258                const el = th.asyncFuncName[i];
259                this.funAsync.push({
260                  name: el,
261                  pid: th.asyncFuncNamePID || 0,
262                });
263              }
264            }
265          } else if (th.asyncFuncThreadName) {
266            if (typeof th.asyncFuncThreadName === 'string') {
267              this.funCatAsync.push({
268                pid: th.asyncFuncNamePID || 0,
269                threadName: th.asyncFuncThreadName,
270              });
271            }
272          } else {
273            this.funTids.push(parseInt(th.rowId!));
274          }
275        } else if (th.rowType === TraceRow.ROW_TYPE_MEM) {
276          this.processTrackIds.push(parseInt(th.rowId!));
277        }
278      });
279      info('load process traceRow id is : ', it.rowId);
280    }
281  }
282
283  // @ts-ignore
284  pushNativeMemory(it: TraceRow<unknown>, sp: SpSystemTrace): void {
285    if (it.rowType === TraceRow.ROW_TYPE_NATIVE_MEMORY) {
286      // @ts-ignore
287      let memoryRows: Array<TraceRow<unknown>> = [
288        // @ts-ignore
289        ...sp.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`trace-row[row-parent-id='${it.rowId}']`),
290      ];
291      if (!it.expansion) {
292        memoryRows = [...it.childrenList];
293      }
294      const rowKey = it.rowId!.split(' ');
295      const process = {
296        ipid: Number(rowKey[rowKey.length - 1]),
297        pid: Number(rowKey[rowKey.length - 2]),
298      };
299      if (!isExistPidInArray(this.nativeMemoryAllProcess, process.pid)) {
300        this.nativeMemoryAllProcess.push(process);
301      }
302      if (this.nativeMemoryCurrentIPid === -1) {
303        this.nativeMemoryCurrentIPid = process.ipid;
304      }
305      memoryRows.forEach((th) => {
306        th.rangeSelect = true;
307        th.checkType = '2';
308        if (th.getAttribute('heap-type') === 'native_hook_statistic') {
309          this.nativeMemoryStatistic.push(th.rowId!);
310        } else {
311          this.nativeMemory.push(th.rowId!);
312        }
313      });
314      info('load nativeMemory traceRow id is : ', it.rowId);
315    }
316  }
317
318  // @ts-ignore
319  pushFunc(it: TraceRow<unknown>, sp: SpSystemTrace): void {
320    if (it.rowType === TraceRow.ROW_TYPE_FUNC) {
321      TabPaneTaskFrames.TaskArray = [];
322      sp.pushPidToSelection(this, it.rowParentId!);
323      if (it.asyncFuncName) {
324        if (typeof it.asyncFuncName === 'string') {
325          this.funAsync.push({
326            name: it.asyncFuncName,
327            pid: it.asyncFuncNamePID || 0,
328          });
329        } else {
330          //@ts-ignore
331          for (let i = 0; i < it.asyncFuncName.length; i++) {
332            const el = it.asyncFuncName[i];
333            this.funAsync.push({
334              name: el,
335              pid: it.asyncFuncNamePID || 0,
336            });
337          }
338        }
339      } else if (it.asyncFuncThreadName) {
340        if (typeof it.asyncFuncThreadName === 'string') {
341          this.funCatAsync.push({
342            pid: it.asyncFuncNamePID || 0,
343            threadName: it.asyncFuncThreadName
344          });
345        } else {
346          for (let i = 0; i < it.asyncFuncThreadName.length; i++) {
347            const tn = it.asyncFuncThreadName[i];
348            this.funCatAsync.push({
349              pid: it.asyncFuncNamePID || 0, //@ts-ignore
350              threadName: tn
351            });
352          }
353        }
354      } else {
355        this.funTids.push(parseInt(it.rowId!));
356      }
357
358      let isIntersect = (filterFunc: FuncStruct, rangeData: RangeSelectStruct): boolean =>
359        Math.max(filterFunc.startTs! + filterFunc.dur!, rangeData!.endNS || 0) -
360        Math.min(filterFunc.startTs!, rangeData!.startNS || 0) <
361        filterFunc.dur! + (rangeData!.endNS || 0) - (rangeData!.startNS || 0) &&
362        filterFunc.funName!.indexOf('H:Task ') >= 0;
363      // @ts-ignore
364      let taskData = it.dataListCache.filter((taskData: FuncStruct) => {
365        taskData!.tid = parseInt(it.rowId!);
366        return isIntersect(taskData, TraceRow.rangeSelectObject!);
367      });
368      if (taskData.length > 0) {
369        // @ts-ignore
370        this.taskFramesData.push(...taskData);
371      }
372      info('load func traceRow id is : ', it.rowId);
373    }
374  }
375
376  // @ts-ignore
377  pushHeap(it: TraceRow<unknown>, sp: SpSystemTrace): void {
378    if (it.rowType === TraceRow.ROW_TYPE_HEAP) {
379      const key = it.rowParentId!.split(' ');
380      const process = {
381        ipid: Number(key[key.length - 1]),
382        pid: Number(key[key.length - 2]),
383      };
384
385      if (!isExistPidInArray(this.nativeMemoryAllProcess, process.pid)) {
386        this.nativeMemoryAllProcess.push(process);
387      }
388      if (this.nativeMemoryCurrentIPid === -1) {
389        this.nativeMemoryCurrentIPid = process.ipid;
390      }
391      if (this.nativeMemoryAllProcess) {
392        if (it.getAttribute('heap-type') === 'native_hook_statistic') {
393          this.nativeMemoryStatistic.push(it.rowId!);
394        } else {
395          this.nativeMemory.push(it.rowId!);
396        }
397      }
398      info('load nativeMemory traceRow id is : ', it.rowId);
399    }
400  }
401
402  // @ts-ignore
403  pushMonitor(it: TraceRow<unknown>, sp: SpSystemTrace): void {
404    if (it.rowType === TraceRow.ROW_TYPE_MONITOR) {
405      // @ts-ignore
406      let abilityChildRows: Array<TraceRow<unknown>> = [
407        // @ts-ignore
408        ...sp.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`trace-row[row-parent-id='${it.rowId}']`),
409      ];
410      if (!it.expansion) {
411        abilityChildRows = [...it.childrenList];
412      }
413      abilityChildRows.forEach((th) => {
414        th.rangeSelect = true;
415        th.checkType = '2';
416        if (th.rowType === TraceRow.ROW_TYPE_CPU_ABILITY) {
417          this.cpuAbilityIds.push(th.rowId!);
418        } else if (th.rowType === TraceRow.ROW_TYPE_MEMORY_ABILITY) {
419          this.memoryAbilityIds.push(th.rowId!);
420        } else if (th.rowType === TraceRow.ROW_TYPE_DISK_ABILITY) {
421          this.diskAbilityIds.push(th.rowId!);
422        } else if (th.rowType === TraceRow.ROW_TYPE_NETWORK_ABILITY) {
423          this.networkAbilityIds.push(th.rowId!);
424        } else if (th.rowType === TraceRow.ROW_TYPE_DMA_ABILITY) {
425          this.dmaAbilityData.push(...intersectData(th)!);
426        } else if (th.rowType === TraceRow.ROW_TYPE_GPU_MEMORY_ABILITY) {
427          this.gpuMemoryAbilityData.push(...intersectData(th)!);
428        } else if (th.rowType === TraceRow.ROW_TYPE_PURGEABLE_TOTAL_ABILITY) {
429          this.purgeableTotalAbility.push(...intersectData(th));
430        } else if (th.rowType === TraceRow.ROW_TYPE_PURGEABLE_PIN_ABILITY) {
431          this.purgeablePinAbility.push(...intersectData(th));
432        }
433      });
434    }
435  }
436
437  // @ts-ignore
438  pushHiperf(it: TraceRow<unknown>, sp: SpSystemTrace): void {
439    if (it.rowType?.startsWith('hiperf')) {
440      if (it.rowType === TraceRow.ROW_TYPE_HIPERF_EVENT || it.rowType === TraceRow.ROW_TYPE_HIPERF_REPORT) {
441        return;
442      }
443      this.perfEventTypeId = it.drawType === -2 ? undefined : it.drawType;
444      this.perfSampleIds.push(1);
445      if (it.rowType === TraceRow.ROW_TYPE_PERF_CALLCHART) {
446        let setting = it.getRowSettingKeys();
447        if (setting && setting.length > 0) {
448          //type 0:cpu,1:process,2:thread
449          let key: string = setting[0];
450          let id = Number(key.split('-')[0]);
451          if (key.includes('p')) {
452            this.perfProcess.push(id);
453          } else if (key.includes('t')) {
454            this.perfThread.push(id);
455          } else {
456            this.perfCpus.push(id);
457          }
458        }
459      }
460      if (it.rowType === TraceRow.ROW_TYPE_HIPERF_PROCESS) {
461        // @ts-ignore
462        let hiperfProcessRows: Array<TraceRow<unknown>> = [
463          // @ts-ignore
464          ...sp.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`trace-row[row-parent-id='${it.rowId}']`),
465        ];
466        if (!it.expansion) {
467          hiperfProcessRows = [...it.childrenList];
468        }
469        hiperfProcessRows.forEach((th) => {
470          th.rangeSelect = true;
471          th.checkType = '2';
472        });
473      }
474      if (it.rowType === TraceRow.ROW_TYPE_HIPERF || it.rowId === 'HiPerf-cpu-merge') {
475        this.perfAll = true;
476      }
477      if (it.rowType === TraceRow.ROW_TYPE_HIPERF_CPU) {
478        this.perfCpus.push(it.index);
479      }
480      if (it.rowType === TraceRow.ROW_TYPE_HIPERF_PROCESS) {
481        this.perfProcess.push(parseInt(it.rowId!.split('-')[0]));
482      }
483      if (it.rowType === TraceRow.ROW_TYPE_HIPERF_THREAD) {
484        this.perfThread.push(parseInt(it.rowId!.split('-')[0]));
485      }
486    }
487  }
488
489  // @ts-ignore
490  pushFileSystem(it: TraceRow<unknown>, sp: SpSystemTrace): void {
491    if (it.rowType === TraceRow.ROW_TYPE_FILE_SYSTEM_GROUP) {
492      it.childrenList.forEach((child) => {
493        child.rangeSelect = true;
494        child.checkType = '2';
495        this.pushFileSystem(child, sp);
496      });
497    }
498    if (it.rowType === TraceRow.ROW_TYPE_FILE_SYSTEM) {
499      if (it.rowId === 'FileSystemLogicalWrite') {
500        if (this.fileSystemType.length === 0) {
501          this.fileSystemType = [0, 1, 3];
502        } else {
503          if (this.fileSystemType.indexOf(3) === -1) {
504            this.fileSystemType.push(3);
505          }
506        }
507      } else if (it.rowId === 'FileSystemLogicalRead') {
508        if (this.fileSystemType.length === 0) {
509          this.fileSystemType = [0, 1, 2];
510        } else {
511          if (this.fileSystemType.indexOf(2) === -1) {
512            this.fileSystemType.push(2);
513          }
514        }
515      } else if (it.rowId === 'FileSystemVirtualMemory') {
516        this.fileSysVirtualMemory = true;
517      } else if (it.rowId === 'FileSystemDiskIOLatency') {
518        this.diskIOLatency = true;
519      } else {
520        if (!this.diskIOLatency) {
521          let arr = it.rowId!.split('-').reverse();
522          let ipid = parseInt(arr[0]);
523          if (this.diskIOipids.indexOf(ipid) === -1) {
524            this.diskIOipids.push(ipid);
525          }
526          if (arr[1] === 'read') {
527            this.diskIOReadIds.indexOf(ipid) === -1 ? this.diskIOReadIds.push(ipid) : '';
528          } else if (arr[1] === 'write') {
529            this.diskIOWriteIds.indexOf(ipid) === -1 ? this.diskIOWriteIds.push(ipid) : '';
530          }
531        }
532      }
533    }
534  }
535  // @ts-ignore
536  vMTrackerGpuChildRowsEvery(item: TraceRow<unknown>): void {
537    item.rangeSelect = true;
538    if (item.rowType === TraceRow.ROW_TYPE_GPU_MEMORY_VMTRACKER) {
539      this.gpuMemoryTrackerData.push(...intersectData(item)!);
540    } else if (item.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_GL) {
541      this.gpu.gl =
542        item.dataListCache.filter(
543          (it) =>
544            // @ts-ignore
545            (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
546            // @ts-ignore
547            (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
548        ).length > 0;
549    } else if (item.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_GRAPH) {
550      this.gpu.graph =
551        item.dataListCache.filter(
552          // @ts-ignore
553          (it) =>
554            // @ts-ignore
555            (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
556            // @ts-ignore
557            (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
558        ).length > 0;
559    } else if (item.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_TOTAL) {
560      this.gpu.gpuTotal =
561        item.dataListCache.filter(
562          (it) =>
563            // @ts-ignore
564            (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
565            // @ts-ignore
566            (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
567        ).length > 0;
568    } else if (item.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_WINDOW) {
569      this.gpu.gpuWindow =
570        item.dataListCache.filter(
571          (it) =>
572            // @ts-ignore
573            (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
574            // @ts-ignore
575            (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
576        ).length > 0;
577    }
578  }
579  // @ts-ignore
580  pushVmTracker(it: TraceRow<unknown>, sp: SpSystemTrace): void {
581    if (it.rowType === TraceRow.ROW_TYPE_VM_TRACKER) {
582      // @ts-ignore
583      let vMTrackerChildRows: Array<TraceRow<unknown>> = [
584        // @ts-ignore
585        ...sp.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`trace-row[row-parent-id='${it.rowId}']`),
586      ];
587      if (!it.expansion) {
588        vMTrackerChildRows = [...it.childrenList];
589      }
590      vMTrackerChildRows.forEach((th) => {
591        th.rangeSelect = true;
592        if (th.rowType === TraceRow.ROW_TYPE_DMA_VMTRACKER) {
593          this.dmaVmTrackerData.push(...intersectData(th)!);
594        } else if (th.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU) {
595          // @ts-ignore
596          let vMTrackerGpuChildRows: Array<TraceRow<unknown>> = [
597            // @ts-ignore
598            ...sp.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`trace-row[row-parent-id='${th.rowId}']`),
599          ];
600          if (!th.expansion) {
601            vMTrackerGpuChildRows = [...th.childrenList];
602          }
603          vMTrackerGpuChildRows.forEach((item) => {
604            this.vMTrackerGpuChildRowsEvery(item);
605          });
606        } else if (th.rowType === TraceRow.ROW_TYPE_PURGEABLE_TOTAL_VM) {
607          this.purgeableTotalVM.push(...intersectData(th));
608        } else if (th.rowType === TraceRow.ROW_TYPE_PURGEABLE_PIN_VM) {
609          this.purgeablePinVM.push(...intersectData(th));
610        } else if (th.rowType === TraceRow.ROW_TYPE_VM_TRACKER_SMAPS) {
611          // @ts-ignore
612          let sMapsChildRows: Array<TraceRow<unknown>> = [
613            // @ts-ignore
614            ...sp.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`trace-row[row-parent-id='${th.rowId}']`),
615          ];
616          if (!th.expansion) {
617            sMapsChildRows = [...th.childrenList];
618          }
619          sMapsChildRows.forEach((item) => {
620            item.rangeSelect = true;
621            if (item.rowType === TraceRow.ROW_TYPE_VM_TRACKER_SMAPS) {
622              this.smapsType.push(...intersectData(item)!);
623            }
624          });
625        } else if (th.rowType === TraceRow.ROW_TYPE_VMTRACKER_SHM) {
626          this.vmtrackershm.push(...intersectData(th)!);
627        }
628      });
629    }
630  }
631
632  // @ts-ignore
633  pushJank(it: TraceRow<unknown>, sp: SpSystemTrace): void {
634    if (it.rowType === TraceRow.ROW_TYPE_JANK) {
635      let isIntersect = (filterJank: JanksStruct, rangeData: RangeSelectStruct): boolean =>
636        Math.max(filterJank.ts! + filterJank.dur!, rangeData!.endNS || 0) -
637        Math.min(filterJank.ts!, rangeData!.startNS || 0) <
638        filterJank.dur! + (rangeData!.endNS || 0) - (rangeData!.startNS || 0);
639      if (it.name === 'Actual Timeline') {
640        if (it.rowParentId === 'frameTime') {
641          it.dataListCache.forEach((jankData: unknown) => {
642            // @ts-ignore
643            if (isIntersect(jankData, TraceRow.rangeSelectObject!)) {
644              this.jankFramesData.push(jankData);
645            }
646          });
647        } else {
648          this.jankFramesData.push(it.rowParentId);
649        }
650      } else if (it.folder) {
651        this.jankFramesData = [];
652        it.childrenList.forEach((child) => {
653          if (child.rowType === TraceRow.ROW_TYPE_JANK && child.name === 'Actual Timeline') {
654            if (child.rowParentId === 'frameTime') {
655              child.dataListCache.forEach((jankData: unknown) => {
656                // @ts-ignore
657                if (isIntersect(jankData, TraceRow.rangeSelectObject!)) {
658                  this.jankFramesData.push(jankData);
659                }
660              });
661            } else {
662              this.jankFramesData.push(child.rowParentId);
663            }
664          }
665        });
666      }
667    }
668  }
669
670  // @ts-ignore
671  pushHeapTimeline(it: TraceRow<unknown>, sp: SpSystemTrace): void {
672    if (it.rowType === TraceRow.ROW_TYPE_HEAP_TIMELINE) {
673      const [rangeStart, rangeEnd] = [TraceRow.range?.startNS, TraceRow.range?.endNS];
674      const startNS = TraceRow.rangeSelectObject?.startNS || rangeStart;
675      const endNS = TraceRow.rangeSelectObject?.endNS || rangeEnd;
676      let minNodeId;
677      let maxNodeId;
678      if (!it.dataListCache || it.dataListCache.length === 0) {
679        return;
680      }
681      for (let sample of it.dataListCache) {
682        // @ts-ignore
683        if (sample.timestamp * 1000 <= startNS!) {
684          // @ts-ignore
685          minNodeId = sample.lastAssignedId;
686        }
687        // 个别文件的sample的最大timestamp小于时间的框选结束时间,不能给maxNodeId赋值
688        // 所以加上此条件:sample.timestamp === it.dataListCache[it.dataListCache.length -1].timestamp
689        if (
690          // @ts-ignore
691          sample.timestamp * 1000 >= endNS! ||
692          // @ts-ignore
693          sample.timestamp === it.dataListCache[it.dataListCache.length - 1].timestamp
694        ) {
695          if (maxNodeId === undefined) {
696            // @ts-ignore
697            maxNodeId = sample.lastAssignedId;
698          }
699        }
700      }
701
702      // If the start time range of the selected box is greater than the end time of the sampled data
703      // @ts-ignore
704      if (startNS! >= it.dataListCache[it.dataListCache.length - 1].timestamp * 1000) {
705        // @ts-ignore
706        minNodeId = it.dataListCache[it.dataListCache.length - 1].lastAssignedId;
707      }
708      // If you select the box from the beginning
709      if (startNS! <= rangeStart!) {
710        minNodeId = HeapDataInterface.getInstance().getMinNodeId(sp.snapshotFiles!.id);
711      }
712      //If you select the box from the ending
713      // @ts-ignore
714      if (endNS! >= rangeEnd! || endNS! >= it.dataListCache[it.dataListCache.length - 1].timestampUs * 1000) {
715        maxNodeId = HeapDataInterface.getInstance().getMaxNodeId(sp.snapshotFiles!.id);
716      }
717      let summary = (sp.traceSheetEL!.shadowRoot!.querySelector('#tabs') as LitTabs)
718        .querySelector('#box-heap-summary')
719        ?.querySelector('tabpane-summary') as TabPaneSummary;
720      summary.initSummaryData(sp.snapshotFiles!, minNodeId, maxNodeId);
721      this.jsMemory.push(1);
722    }
723  }
724
725  // @ts-ignore
726  pushJsCpuProfiler(it: TraceRow<unknown>, sp: SpSystemTrace): void {
727    if (it.rowType === TraceRow.ROW_TYPE_JS_CPU_PROFILER) {
728      let isIntersect = (a: JsCpuProfilerStruct, b: RangeSelectStruct): boolean =>
729        Math.max(a.startTime! + a.totalTime!, b!.endNS || 0) - Math.min(a.startTime!, b!.startNS || 0) <
730        a.totalTime! + (b!.endNS || 0) - (b!.startNS || 0);
731      let frameSelectData = it.dataListCache.filter((frameSelectData: unknown) => {
732        // @ts-ignore
733        return isIntersect(frameSelectData, TraceRow.rangeSelectObject!);
734      });
735      let copyFrameSelectData = JSON.parse(JSON.stringify(frameSelectData));
736      let frameSelectDataIdArr: Array<number> = [];
737      for (let data of copyFrameSelectData) {
738        frameSelectDataIdArr.push(data.id);
739      }
740      let jsCpuProfilerData = copyFrameSelectData.filter((item: JsCpuProfilerChartFrame) => {
741        // @ts-ignore
742        if (item.depth === 0) {
743          // @ts-ignore
744          setSelectState(item, frameSelectDataIdArr);
745          // @ts-ignore
746          item.isSelect = true;
747        }
748        return item.depth === 0;
749      });
750      this.jsCpuProfilerData = jsCpuProfilerData;
751    }
752  }
753
754  // @ts-ignore
755  pushSysMemoryGpu(it: TraceRow<unknown>, sp: SpSystemTrace): void {
756    // @ts-ignore
757    if (it.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU) {
758      // @ts-ignore
759      let vMTrackerGpuChildRows: Array<TraceRow<unknown>> = [
760        // @ts-ignore
761        ...sp.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`trace-row[row-parent-id='${it.rowId}']`),
762      ];
763      if (!it.expansion) {
764        vMTrackerGpuChildRows = [...it.childrenList];
765      }
766      vMTrackerGpuChildRows.forEach((th) => {
767        th.rangeSelect = true;
768        if (th.rowType === TraceRow.ROW_TYPE_GPU_MEMORY_VMTRACKER) {
769          this.gpuMemoryTrackerData.push(...intersectData(th)!);
770        } else if (th.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_GL) {
771          this.gpu.gl =
772            th.dataListCache.filter(
773              (it) =>
774                // @ts-ignore
775                (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
776                // @ts-ignore
777                (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
778            ).length > 0;
779        } else if (th.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_GRAPH) {
780          this.gpu.graph =
781            th.dataListCache.filter(
782              (it) =>
783                // @ts-ignore
784                (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
785                // @ts-ignore
786                (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
787            ).length > 0;
788        } else if (th.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_TOTAL) {
789          this.gpu.gpuTotal =
790            th.dataListCache.filter(
791              (it) =>
792                // @ts-ignore
793                (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
794                // @ts-ignore
795                (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
796            ).length > 0;
797        } else if (th.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_WINDOW) {
798          this.gpu.gpuWindow =
799            th.dataListCache.filter(
800              (it) =>
801                // @ts-ignore
802                (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
803                // @ts-ignore
804                (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
805            ).length > 0;
806        }
807      });
808    }
809  }
810
811  // @ts-ignore
812  pushSDK(it: TraceRow<unknown>, sp: SpSystemTrace): void {
813    if (it.rowType?.startsWith(TraceRow.ROW_TYPE_SDK)) {
814      if (it.rowType === TraceRow.ROW_TYPE_SDK) {
815        // @ts-ignore
816        let sdkRows: Array<TraceRow<unknown>> = [
817          // @ts-ignore
818          ...sp.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`trace-row[row-parent-id='${it.rowId}']`),
819        ];
820        if (!it.expansion) {
821          sdkRows = [...it.childrenList];
822        }
823        sdkRows.forEach((th) => {
824          th.rangeSelect = true;
825          th.checkType = '2';
826        });
827      }
828      if (it.rowType === TraceRow.ROW_TYPE_SDK_COUNTER) {
829        this.sdkCounterIds.push(it.rowId!);
830      }
831      if (it.rowType === TraceRow.ROW_TYPE_SDK_SLICE) {
832        this.sdkSliceIds.push(it.rowId!);
833      }
834    }
835  }
836
837  // @ts-ignore
838  pushVmTrackerSmaps(it: TraceRow<unknown>, sp: SpSystemTrace): void {
839    if (it.rowType === TraceRow.ROW_TYPE_VM_TRACKER_SMAPS) {
840      this.smapsType.push(...intersectData(it)!);
841      // @ts-ignore
842      let sMapsChildRows: Array<TraceRow<unknown>> = [
843        // @ts-ignore
844        ...sp.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`trace-row[row-parent-id='${it.rowId}']`),
845      ];
846      if (!it.expansion) {
847        sMapsChildRows = [...it.childrenList];
848      }
849      sMapsChildRows.forEach((item) => {
850        item.rangeSelect = true;
851        if (item.rowType === TraceRow.ROW_TYPE_VM_TRACKER_SMAPS) {
852          this.smapsType.push(...intersectData(item)!);
853        }
854      });
855    }
856  }
857
858  // @ts-ignore
859  pushIrq(it: TraceRow<unknown>): void {
860    if (it.rowType === TraceRow.ROW_TYPE_IRQ_GROUP) {
861      it.childrenList.forEach((child) => {
862        child.rangeSelect = true;
863        child.checkType = '2';
864        this.pushIrq(child);
865      });
866    }
867    if (it.rowType === TraceRow.ROW_TYPE_IRQ) {
868      let filterId = parseInt(it.getAttribute('callId') || '-1');
869      if (it.getAttribute('cat') === 'irq') {
870        if (this.irqCallIds.indexOf(filterId) === -1) {
871          this.irqCallIds.push(filterId);
872        }
873      } else {
874        if (this.softIrqCallIds.indexOf(filterId) === -1) {
875          this.softIrqCallIds.push(filterId);
876        }
877      }
878    }
879  }
880
881  // @ts-ignore
882  pushSysMemoryGpuGl(it: TraceRow<unknown>, sp: SpSystemTrace): void {
883    if (it.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_GL) {
884      this.gpu.gl =
885        it.dataListCache.filter(
886          (it) =>
887            // @ts-ignore
888            (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
889            // @ts-ignore
890            (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
891        ).length > 0;
892    }
893  }
894
895  // @ts-ignore
896  pushFrameDynamic(it: TraceRow<unknown>, sp: SpSystemTrace): void {
897    if (it.rowType === TraceRow.ROW_TYPE_FRAME_DYNAMIC) {
898      let appName = it.getAttribute('model-name');
899      let isSelect = (dynamicStruct: FrameDynamicStruct, b: RangeSelectStruct): boolean =>
900        dynamicStruct.ts >= b.startNS! && dynamicStruct.ts <= b.endNS!;
901      let frameDynamicList = it.dataListCache.filter(
902        // @ts-ignore
903        (frameAnimationBean: FrameDynamicStruct) =>
904          isSelect(frameAnimationBean, TraceRow.rangeSelectObject!) &&
905          frameAnimationBean.groupId !== -1 &&
906          frameAnimationBean.appName === appName
907      );
908      // @ts-ignore
909      this.frameDynamic.push(...frameDynamicList);
910    }
911  }
912
913  // @ts-ignore
914  pushFrameSpacing(it: TraceRow<unknown>): void {
915    if (it.rowType === TraceRow.ROW_TYPE_FRAME_SPACING) {
916      let appName = it.getAttribute('model-name');
917      let isSelect = (a: FrameSpacingStruct, b: RangeSelectStruct): boolean =>
918        a.currentTs >= b.startNS! && a.currentTs <= b.endNS!;
919      // @ts-ignore
920      let frameDatas = it.dataListCache.filter((frameData: FrameSpacingStruct) => {
921        return (
922          isSelect(frameData, TraceRow.rangeSelectObject!) &&
923          frameData.groupId !== -1 &&
924          frameData.frameSpacingResult !== -1 &&
925          frameData.nameId === appName
926        );
927      });
928      // @ts-ignore
929      this.frameSpacing.push(...frameDatas);
930    }
931  }
932
933  // @ts-ignore
934  pushFrameAnimation(it: TraceRow<unknown>): void {
935    if (it.rowType === TraceRow.ROW_TYPE_FRAME_ANIMATION) {
936      let isIntersect = (animationStruct: FrameAnimationStruct, selectStruct: RangeSelectStruct): boolean =>
937        Math.max(animationStruct.startTs! + animationStruct.dur!, selectStruct!.endNS || 0) -
938        Math.min(animationStruct.startTs!, selectStruct!.startNS || 0) <
939        animationStruct.dur! + (selectStruct!.endNS || 0) - (selectStruct!.startNS || 0);
940      // @ts-ignore
941      let frameAnimationList = it.dataListCache.filter((frameAnimationBean: FrameAnimationStruct) => {
942        return isIntersect(frameAnimationBean, TraceRow.rangeSelectObject!);
943      });
944      // @ts-ignore
945      this.frameAnimation.push(...frameAnimationList);
946    }
947  }
948
949  // @ts-ignore
950  pushSysMemoryGpuWindow(it: TraceRow<unknown>): void {
951    if (it.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_WINDOW) {
952      this.gpu.gpuWindow =
953        it.dataListCache.filter(
954          (it) =>
955            // @ts-ignore
956            (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
957            // @ts-ignore
958            (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
959        ).length > 0;
960    }
961  }
962
963  // @ts-ignore
964  pushSysMemoryGpuTotal(it: TraceRow<unknown>): void {
965    if (it.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_TOTAL) {
966      this.gpu.gpuTotal =
967        it.dataListCache.filter(
968          (it) =>
969            // @ts-ignore
970            (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
971            // @ts-ignore
972            (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
973        ).length > 0;
974    }
975  }
976
977  // @ts-ignore
978  pushSysMemoryGpuGraph(it: TraceRow<unknown>): void {
979    if (it.rowType === TraceRow.ROW_TYPE_SYS_MEMORY_GPU_GRAPH) {
980      this.gpu.graph =
981        it.dataListCache.filter(
982          (it) =>
983            // @ts-ignore
984            (it.startNs >= this.leftNs && it.startNs <= this.rightNs) ||
985            // @ts-ignore
986            (it.endNs >= this.leftNs && it.endNs <= this.rightNs)
987        ).length > 0;
988    }
989  }
990
991  // @ts-ignore
992  pushStaticInit(it: TraceRow<unknown>, sp: SpSystemTrace): void {
993    if (it.rowType === TraceRow.ROW_TYPE_STATIC_INIT) {
994      this.staticInit = true;
995      sp.pushPidToSelection(this, it.rowParentId!);
996      info('load thread traceRow id is : ', it.rowId);
997    }
998  }
999
1000  // @ts-ignore
1001  pushAppStartUp(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1002    if (it.rowType === TraceRow.ROW_TYPE_APP_STARTUP) {
1003      this.startup = true;
1004      sp.pushPidToSelection(this, it.rowParentId!);
1005      info('load thread traceRow id is : ', it.rowId);
1006    }
1007  }
1008
1009  // @ts-ignore
1010  pushThread(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1011    this.perfEventTypeId = TraceRow.ROW_TYPE_HIPERF_THREADTYPE[0] === -2 ? undefined : TraceRow.ROW_TYPE_HIPERF_THREADTYPE[0];
1012    if (it.rowType === TraceRow.ROW_TYPE_THREAD) {
1013      sp.pushPidToSelection(this, it.rowParentId!);
1014      if (it.dataListCache && it.dataListCache.length) {
1015        //@ts-ignore
1016        let hiTid = it.dataListCache[0]!.tid;
1017        this.perfThread.push(parseInt(hiTid));
1018      }
1019      this.threadIds.push(parseInt(it.rowId!));
1020      info('load thread traceRow id is : ', it.rowId);
1021    }
1022  }
1023
1024  // @ts-ignore
1025  pushVirtualMemory(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1026    if (it.rowType === TraceRow.ROW_TYPE_MEM || it.rowType === TraceRow.ROW_TYPE_VIRTUAL_MEMORY) {
1027      if (it.rowType === TraceRow.ROW_TYPE_MEM) {
1028        this.processTrackIds.push(parseInt(it.rowId!));
1029      } else {
1030        this.virtualTrackIds.push(parseInt(it.rowId!));
1031      }
1032      info('load memory traceRow id is : ', it.rowId);
1033    }
1034  }
1035
1036  // @ts-ignore
1037  pushFps(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1038    if (it.rowType === TraceRow.ROW_TYPE_FPS) {
1039      this.hasFps = true;
1040      info('load FPS traceRow id is : ', it.rowId);
1041    }
1042  }
1043
1044  // @ts-ignore
1045  pushCpuAbility(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1046    if (it.rowType === TraceRow.ROW_TYPE_CPU_ABILITY) {
1047      this.cpuAbilityIds.push(it.rowId!);
1048      info('load CPU Ability traceRow id is : ', it.rowId);
1049    }
1050  }
1051
1052  // @ts-ignore
1053  pushMemoryAbility(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1054    if (it.rowType === TraceRow.ROW_TYPE_MEMORY_ABILITY) {
1055      this.memoryAbilityIds.push(it.rowId!);
1056      info('load Memory Ability traceRow id is : ', it.rowId);
1057    }
1058  }
1059
1060  // @ts-ignore
1061  pushDiskAbility(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1062    if (it.rowType === TraceRow.ROW_TYPE_DISK_ABILITY) {
1063      this.diskAbilityIds.push(it.rowId!);
1064      info('load DiskIo Ability traceRow id is : ', it.rowId);
1065    }
1066  }
1067
1068  // @ts-ignore
1069  pushNetworkAbility(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1070    if (it.rowType === TraceRow.ROW_TYPE_NETWORK_ABILITY) {
1071      this.networkAbilityIds.push(it.rowId!);
1072      info('load Network Ability traceRow id is : ', it.rowId);
1073    }
1074  }
1075
1076  // @ts-ignore
1077  pushDmaAbility(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1078    if (it.rowType === TraceRow.ROW_TYPE_DMA_ABILITY) {
1079      this.dmaAbilityData.push(...intersectData(it)!);
1080    }
1081  }
1082
1083  // @ts-ignore
1084  pushGpuMemoryAbility(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1085    if (it.rowType === TraceRow.ROW_TYPE_GPU_MEMORY_ABILITY) {
1086      this.gpuMemoryAbilityData.push(...intersectData(it)!);
1087    }
1088  }
1089
1090  // @ts-ignore
1091  pushPowerEnergy(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1092    if (it.rowType === TraceRow.ROW_TYPE_POWER_ENERGY) {
1093      this.powerEnergy.push(it.rowId!);
1094    }
1095  }
1096
1097  // @ts-ignore
1098  pushSystemEnergy(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1099    if (it.rowType === TraceRow.ROW_TYPE_SYSTEM_ENERGY) {
1100      this.systemEnergy.push(it.rowId!);
1101    }
1102  }
1103
1104  // @ts-ignore
1105  pushAnomalyEnergy(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1106    if (it.rowType === TraceRow.ROW_TYPE_ANOMALY_ENERGY) {
1107      this.anomalyEnergy.push(it.rowId!);
1108    }
1109  }
1110
1111  // @ts-ignore
1112  pushVmTrackerShm(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1113    if (it.rowType === TraceRow.ROW_TYPE_VMTRACKER_SHM) {
1114      this.vmtrackershm.push(...intersectData(it)!);
1115    }
1116  }
1117
1118  // @ts-ignore
1119  pushClock(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1120    if (it.rowType === TraceRow.ROW_TYPE_CLOCK_GROUP) {
1121      it.childrenList.forEach((it) => {
1122        it.rangeSelect = true;
1123        it.checkType = '2';
1124        this.clockMapData.set(it.rowId || '', it.getCacheData);
1125      });
1126    }
1127    if (it.rowType === TraceRow.ROW_TYPE_CLOCK) {
1128      this.clockMapData.set(it.rowId || '', it.getCacheData);
1129    }
1130  }
1131
1132  //匹配id
1133  // @ts-ignore
1134  pushDmaFence(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1135    if (it.rowType === TraceRow.ROW_TYPE_DMA_FENCE) {
1136      this.dmaFenceNameData.push(it.rowId!);
1137    }
1138  }
1139
1140  // @ts-ignore
1141  pushHang(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1142    if (it.rowType === TraceRow.ROW_TYPE_HANG_GROUP) {
1143      it.childrenList.forEach((it) => {
1144        it.rangeSelect = true;
1145        it.checkType = '2';
1146        this.hangMapData.set(it.rowId || '', it.getCacheData);
1147      });
1148    }
1149    if (it.rowType === TraceRow.ROW_TYPE_HANG || it.rowType === TraceRow.ROW_TYPE_HANG_INNER) {
1150      this.hangMapData.set(it.rowId || '', it.getCacheData);
1151    }
1152  }
1153
1154  // @ts-ignore
1155  pushGpuMemoryVmTracker(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1156    if (it.rowType === TraceRow.ROW_TYPE_GPU_MEMORY_VMTRACKER) {
1157      this.gpuMemoryTrackerData.push(...intersectData(it)!);
1158    }
1159  }
1160
1161  // @ts-ignore
1162  pushDmaVmTracker(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1163    if (it.rowType === TraceRow.ROW_TYPE_DMA_VMTRACKER) {
1164      this.dmaVmTrackerData.push(...intersectData(it)!);
1165    }
1166  }
1167
1168  // @ts-ignore
1169  pushPugreable(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1170    if (it.rowType === TraceRow.ROW_TYPE_PURGEABLE_TOTAL_ABILITY) {
1171      this.purgeableTotalAbility.push(...intersectData(it));
1172    }
1173    if (it.rowType === TraceRow.ROW_TYPE_PURGEABLE_PIN_ABILITY) {
1174      this.purgeablePinAbility.push(...intersectData(it));
1175    }
1176    if (it.rowType === TraceRow.ROW_TYPE_PURGEABLE_TOTAL_VM) {
1177      this.purgeableTotalVM.push(...intersectData(it));
1178    }
1179    if (it.rowType === TraceRow.ROW_TYPE_PURGEABLE_PIN_VM) {
1180      this.purgeablePinVM.push(...intersectData(it));
1181    }
1182  }
1183
1184  // @ts-ignore
1185  pushPugreablePinAbility(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1186    if (it.rowType === TraceRow.ROW_TYPE_PURGEABLE_PIN_ABILITY) {
1187      this.purgeablePinAbility.push(...intersectData(it));
1188    }
1189  }
1190
1191  // @ts-ignore
1192  pushPugreableTotalVm(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1193    if (it.rowType === TraceRow.ROW_TYPE_PURGEABLE_TOTAL_VM) {
1194      this.purgeableTotalVM.push(...intersectData(it));
1195    }
1196  }
1197
1198  // @ts-ignore
1199  pushPugreablePinVm(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1200    if (it.rowType === TraceRow.ROW_TYPE_PURGEABLE_PIN_VM) {
1201      this.purgeablePinVM.push(...intersectData(it));
1202    }
1203  }
1204
1205  // @ts-ignore
1206  pushLogs(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1207    if (it.rowType === TraceRow.ROW_TYPE_LOGS) {
1208      this.hiLogs.push(it.rowId!);
1209    }
1210  }
1211
1212  // @ts-ignore
1213  pushHiSysEvent(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1214    if (it.rowType === TraceRow.ROW_TYPE_HI_SYSEVENT) {
1215      this.hiSysEvents.push(it.rowId!);
1216    }
1217  }
1218
1219  // @ts-ignore
1220  pushSelection(it: TraceRow<unknown>, sp: SpSystemTrace): void {
1221    this.pushCpus(it);
1222    this.pushCpuStateFilterIds(it);
1223    this.pushCpuFreqFilter(it);
1224    this.pushCpuFreqLimit(it);
1225    this.pushProcess(it, sp);
1226    this.pushNativeMemory(it, sp);
1227    this.pushFunc(it, sp);
1228    this.pushHeap(it, sp);
1229    this.pushMonitor(it, sp);
1230    this.pushHiperf(it, sp);
1231    this.pushFileSystem(it, sp);
1232    this.pushJank(it, sp);
1233    this.pushHeapTimeline(it, sp);
1234    this.pushJsCpuProfiler(it, sp);
1235    this.pushSysMemoryGpu(it, sp);
1236    this.pushSDK(it, sp);
1237    this.pushVmTrackerSmaps(it, sp);
1238    this.pushIrq(it);
1239    this.pushSysMemoryGpuGl(it, sp);
1240    this.pushFrameDynamic(it, sp);
1241    this.pushFrameSpacing(it);
1242    this.pushFrameAnimation(it);
1243    this.pushSysMemoryGpuWindow(it);
1244    this.pushSysMemoryGpuTotal(it);
1245    this.pushSysMemoryGpuGraph(it);
1246    this.pushStaticInit(it, sp);
1247    this.pushAppStartUp(it, sp);
1248    this.pushThread(it, sp);
1249    this.pushVirtualMemory(it, sp);
1250    this.pushFps(it, sp);
1251    this.pushCpuAbility(it, sp);
1252    this.pushMemoryAbility(it, sp);
1253    this.pushDiskAbility(it, sp);
1254    this.pushNetworkAbility(it, sp);
1255    this.pushDmaAbility(it, sp);
1256    this.pushGpuMemoryAbility(it, sp);
1257    this.pushPowerEnergy(it, sp);
1258    this.pushSystemEnergy(it, sp);
1259    this.pushAnomalyEnergy(it, sp);
1260    this.pushVmTracker(it, sp);
1261    this.pushVmTrackerShm(it, sp);
1262    this.pushClock(it, sp);
1263    this.pushDmaFence(it, sp);
1264    this.pushHang(it, sp);
1265    this.pushGpuMemoryVmTracker(it, sp);
1266    this.pushDmaVmTracker(it, sp);
1267    this.pushPugreable(it, sp);
1268    this.pushLogs(it, sp);
1269    this.pushHiSysEvent(it, sp);
1270    this.pushSampleData(it);
1271  }
1272}
1273
1274export class BoxJumpParam {
1275  traceId: string | undefined | null;
1276  leftNs: number = 0;
1277  rightNs: number = 0;
1278  cpus: Array<number> = [];
1279  state: string = '';
1280  processId: number[] | undefined;
1281  threadId: number[] | undefined;
1282  isJumpPage: boolean | undefined;
1283  currentId: string | undefined | null;
1284}
1285
1286export class SliceBoxJumpParam {
1287  traceId: string | undefined | null;
1288  leftNs: number = 0;
1289  rightNs: number = 0;
1290  processId: Array<number> = [];
1291  threadId: Array<number> = [];
1292  name: string[] | undefined | null;
1293  isJumpPage: boolean | undefined;
1294  asyncNames: Array<string> = [];
1295  asyncCatNames: Array<string> = [];
1296}
1297
1298export class SelectionData {
1299  name: string = '';
1300  process: string = '';
1301  pid: string = '';
1302  thread: string = '';
1303  tid: string = '';
1304  wallDuration: number = 0;
1305  wallDurationFormat: string = '';
1306  avgDuration: string = '';
1307  maxDuration: number = 0;
1308  maxDurationFormat: string = '';
1309  occurrences: number = 0;
1310  state: string = '';
1311  trackId: number = 0;
1312  delta: string = '';
1313  rate: string = '';
1314  avgWeight: string = '';
1315  count: string = '';
1316  first: string = '';
1317  last: string = '';
1318  min: string = '';
1319  max: string = '';
1320  stateJX: string = '';
1321  cpu: number = 0;
1322  recordStartNs: number = 0;
1323  leftNs: number = 0;
1324  rightNs: number = 0;
1325  threadIds: Array<number> = [];
1326  ts: number = 0;
1327  dur: number = 0;
1328  tabTitle: string = '';
1329  allName: string[] | undefined;
1330  asyncNames: Array<string> = [];
1331  asyncCatNames: Array<string> = [];
1332}
1333
1334export class Counter {
1335  id: number = 0;
1336  trackId: number = 0;
1337  name: string = '';
1338  value: number = 0;
1339  startTime: number = 0;
1340}
1341
1342export class Fps {
1343  startNS: number = 0;
1344  timeStr: string = '';
1345  fps: number = 0;
1346}
1347
1348export class GpuCounter {
1349  startNS: number = 0;
1350  height: number = 0;
1351  dur: number = 0;
1352  type: string = '';
1353  startTime: number = 0;
1354  frame: object = {};
1355}
1356