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