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