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