1fb726d48Sopenharmony_ci/*
2fb726d48Sopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
3fb726d48Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4fb726d48Sopenharmony_ci * you may not use this file except in compliance with the License.
5fb726d48Sopenharmony_ci * You may obtain a copy of the License at
6fb726d48Sopenharmony_ci *
7fb726d48Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8fb726d48Sopenharmony_ci *
9fb726d48Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10fb726d48Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11fb726d48Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12fb726d48Sopenharmony_ci * See the License for the specific language governing permissions and
13fb726d48Sopenharmony_ci * limitations under the License.
14fb726d48Sopenharmony_ci */
15fb726d48Sopenharmony_ci
16fb726d48Sopenharmony_ciimport { BaseElement, element } from '../../base-ui/BaseElement';
17fb726d48Sopenharmony_ciimport './trace/TimerShaftElement';
18fb726d48Sopenharmony_ciimport './trace/base/TraceRow';
19fb726d48Sopenharmony_ciimport { threadPool, threadPool2 } from '../database/SqlLite';
20fb726d48Sopenharmony_ciimport { TraceRow } from './trace/base/TraceRow';
21fb726d48Sopenharmony_ciimport { TimerShaftElement } from './trace/TimerShaftElement';
22fb726d48Sopenharmony_ciimport './trace/base/TraceSheet';
23fb726d48Sopenharmony_ciimport { TraceSheet } from './trace/base/TraceSheet';
24fb726d48Sopenharmony_ciimport { RangeSelect } from './trace/base/RangeSelect';
25fb726d48Sopenharmony_ciimport { SelectionParam } from '../bean/BoxSelection';
26fb726d48Sopenharmony_ciimport { procedurePool } from '../database/Procedure';
27fb726d48Sopenharmony_ciimport { SpApplication } from '../SpApplication';
28fb726d48Sopenharmony_ciimport { Flag } from './trace/timer-shaft/Flag';
29fb726d48Sopenharmony_ciimport { SlicesTime, SportRuler } from './trace/timer-shaft/SportRuler';
30fb726d48Sopenharmony_ciimport { SpHiPerf } from './chart/SpHiPerf';
31fb726d48Sopenharmony_ciimport { SearchSdkBean } from '../bean/SearchFuncBean';
32fb726d48Sopenharmony_ciimport { info } from '../../log/Log';
33fb726d48Sopenharmony_ciimport {
34fb726d48Sopenharmony_ci  drawFlagLineSegment,
35fb726d48Sopenharmony_ci  drawLines,
36fb726d48Sopenharmony_ci  drawLinkLines,
37fb726d48Sopenharmony_ci  drawLogsLineSegment,
38fb726d48Sopenharmony_ci  drawWakeUp,
39fb726d48Sopenharmony_ci  drawWakeUpList,
40fb726d48Sopenharmony_ci  LineType,
41fb726d48Sopenharmony_ci  ns2x,
42fb726d48Sopenharmony_ci  ns2xByTimeShaft,
43fb726d48Sopenharmony_ci  PairPoint,
44fb726d48Sopenharmony_ci  Rect,
45fb726d48Sopenharmony_ci  prioClickHandlerFun,
46fb726d48Sopenharmony_ci  drawThreadCurve,
47fb726d48Sopenharmony_ci} from '../database/ui-worker/ProcedureWorkerCommon';
48fb726d48Sopenharmony_ciimport { SpChartManager } from './chart/SpChartManager';
49fb726d48Sopenharmony_ciimport { CpuStruct, WakeupBean } from '../database/ui-worker/cpu/ProcedureWorkerCPU';
50fb726d48Sopenharmony_ciimport { ProcessStruct } from '../database/ui-worker/ProcedureWorkerProcess';
51fb726d48Sopenharmony_ciimport { CpuFreqStruct } from '../database/ui-worker/ProcedureWorkerFreq';
52fb726d48Sopenharmony_ciimport { CpuFreqLimitsStruct } from '../database/ui-worker/cpu/ProcedureWorkerCpuFreqLimits';
53fb726d48Sopenharmony_ciimport { ThreadStruct } from '../database/ui-worker/ProcedureWorkerThread';
54fb726d48Sopenharmony_ciimport { FuncStruct } from '../database/ui-worker/ProcedureWorkerFunc';
55fb726d48Sopenharmony_ciimport { CpuStateStruct } from '../database/ui-worker/cpu/ProcedureWorkerCpuState';
56fb726d48Sopenharmony_ciimport { HiPerfCpuStruct } from '../database/ui-worker/hiperf/ProcedureWorkerHiPerfCPU2';
57fb726d48Sopenharmony_ciimport { HiPerfProcessStruct } from '../database/ui-worker/hiperf/ProcedureWorkerHiPerfProcess2';
58fb726d48Sopenharmony_ciimport { HiPerfThreadStruct } from '../database/ui-worker/hiperf/ProcedureWorkerHiPerfThread2';
59fb726d48Sopenharmony_ciimport { HiPerfEventStruct } from '../database/ui-worker/hiperf/ProcedureWorkerHiPerfEvent';
60fb726d48Sopenharmony_ciimport { HiPerfReportStruct } from '../database/ui-worker/hiperf/ProcedureWorkerHiPerfReport';
61fb726d48Sopenharmony_ciimport { FpsStruct } from '../database/ui-worker/ProcedureWorkerFPS';
62fb726d48Sopenharmony_ciimport { CpuAbilityMonitorStruct } from '../database/ui-worker/ProcedureWorkerCpuAbility';
63fb726d48Sopenharmony_ciimport { DiskAbilityMonitorStruct } from '../database/ui-worker/ProcedureWorkerDiskIoAbility';
64fb726d48Sopenharmony_ciimport { MemoryAbilityMonitorStruct } from '../database/ui-worker/ProcedureWorkerMemoryAbility';
65fb726d48Sopenharmony_ciimport { NetworkAbilityMonitorStruct } from '../database/ui-worker/ProcedureWorkerNetworkAbility';
66fb726d48Sopenharmony_ciimport { ClockStruct } from '../database/ui-worker/ProcedureWorkerClock';
67fb726d48Sopenharmony_ciimport { DmaFenceStruct } from '../database/ui-worker/ProcedureWorkerDmaFence';
68fb726d48Sopenharmony_ciimport { Utils } from './trace/base/Utils';
69fb726d48Sopenharmony_ciimport { IrqStruct } from '../database/ui-worker/ProcedureWorkerIrq';
70fb726d48Sopenharmony_ciimport { JankStruct } from '../database/ui-worker/ProcedureWorkerJank';
71fb726d48Sopenharmony_ciimport { TabPaneCurrent } from './trace/sheet/TabPaneCurrent';
72fb726d48Sopenharmony_ciimport { HeapStruct } from '../database/ui-worker/ProcedureWorkerHeap';
73fb726d48Sopenharmony_ciimport { SpStatisticsHttpUtil } from '../../statistics/util/SpStatisticsHttpUtil';
74fb726d48Sopenharmony_ciimport { HeapSnapshotStruct } from '../database/ui-worker/ProcedureWorkerHeapSnapshot';
75fb726d48Sopenharmony_ciimport { HeapDataInterface } from '../../js-heap/HeapDataInterface';
76fb726d48Sopenharmony_ciimport { LitTabs } from '../../base-ui/tabs/lit-tabs';
77fb726d48Sopenharmony_ciimport { TraceRowConfig } from './trace/base/TraceRowConfig';
78fb726d48Sopenharmony_ciimport { TabPaneCurrentSelection } from './trace/sheet/TabPaneCurrentSelection';
79fb726d48Sopenharmony_ciimport { SpChartList } from './trace/SpChartList';
80fb726d48Sopenharmony_ciimport './trace/SpChartList';
81fb726d48Sopenharmony_ciimport { AppStartupStruct } from '../database/ui-worker/ProcedureWorkerAppStartup';
82fb726d48Sopenharmony_ciimport { AllAppStartupStruct } from '../database/ui-worker/ProcedureWorkerAllAppStartup';
83fb726d48Sopenharmony_ciimport { SoStruct } from '../database/ui-worker/ProcedureWorkerSoInit';
84fb726d48Sopenharmony_ciimport { FrameDynamicStruct } from '../database/ui-worker/ProcedureWorkerFrameDynamic';
85fb726d48Sopenharmony_ciimport { FrameAnimationStruct } from '../database/ui-worker/ProcedureWorkerFrameAnimation';
86fb726d48Sopenharmony_ciimport { FrameSpacingStruct } from '../database/ui-worker/ProcedureWorkerFrameSpacing';
87fb726d48Sopenharmony_ciimport { JsCpuProfilerStruct } from '../database/ui-worker/ProcedureWorkerCpuProfiler';
88fb726d48Sopenharmony_ciimport { FileInfo } from '../../js-heap/model/UiStruct';
89fb726d48Sopenharmony_ciimport { SnapshotStruct } from '../database/ui-worker/ProcedureWorkerSnapshot';
90fb726d48Sopenharmony_ciimport { TabPaneFrequencySample } from './trace/sheet/cpu/TabPaneFrequencySample';
91fb726d48Sopenharmony_ciimport { TabPaneCounterSample } from './trace/sheet/cpu/TabPaneCounterSample';
92fb726d48Sopenharmony_ciimport { TabPaneFlag } from './trace/timer-shaft/TabPaneFlag';
93fb726d48Sopenharmony_ciimport { LitTabpane } from '../../base-ui/tabs/lit-tabpane';
94fb726d48Sopenharmony_ciimport { HiPerfCallChartStruct } from '../database/ui-worker/hiperf/ProcedureWorkerHiPerfCallChart';
95fb726d48Sopenharmony_ciimport { InitAnalysis } from '../database/logic-worker/ProcedureLogicWorkerCommon';
96fb726d48Sopenharmony_ciimport { searchCpuDataSender } from '../database/data-trafic/CpuDataSender';
97fb726d48Sopenharmony_ciimport { resetVSync } from './chart/VSync';
98fb726d48Sopenharmony_ciimport { QueryEnum } from '../database/data-trafic/utils/QueryEnum';
99fb726d48Sopenharmony_ciimport { SpSystemTraceHtml } from './SpSystemTrace.html';
100fb726d48Sopenharmony_ciimport { querySceneSearchFunc, querySearchFunc } from '../database/sql/Func.sql';
101fb726d48Sopenharmony_ciimport { queryCpuKeyPathData } from '../database/sql/Cpu.sql';
102fb726d48Sopenharmony_ciimport { LtpoStruct } from '../database/ui-worker/ProcedureWorkerLTPO';
103fb726d48Sopenharmony_ciimport { HitchTimeStruct } from '../database/ui-worker/ProcedureWorkerHitchTime';
104fb726d48Sopenharmony_ciimport { ProcessMemStruct } from '../database/ui-worker/ProcedureWorkerMem';
105fb726d48Sopenharmony_ciimport {
106fb726d48Sopenharmony_ci  spSystemTraceInit,
107fb726d48Sopenharmony_ci  spSystemTraceInitElement,
108fb726d48Sopenharmony_ci  spSystemTraceInitPointToEvent,
109fb726d48Sopenharmony_ci  spSystemTraceParentRowSticky,
110fb726d48Sopenharmony_ci  spSystemTraceShowStruct,
111fb726d48Sopenharmony_ci} from './SpSystemTrace.init';
112fb726d48Sopenharmony_ciimport {
113fb726d48Sopenharmony_ci  spSystemTraceDrawDistributedLine,
114fb726d48Sopenharmony_ci  spSystemTraceDrawFuncLine,
115fb726d48Sopenharmony_ci  spSystemTraceDrawJankLine,
116fb726d48Sopenharmony_ci  spSystemTraceDrawTaskPollLine,
117fb726d48Sopenharmony_ci  spSystemTraceDrawThreadLine,
118fb726d48Sopenharmony_ci} from './SpSystemTrace.line';
119fb726d48Sopenharmony_ciimport spSystemTraceOnClickHandler, {
120fb726d48Sopenharmony_ci  spSystemTraceDocumentOnClick,
121fb726d48Sopenharmony_ci  spSystemTraceDocumentOnKeyDown,
122fb726d48Sopenharmony_ci  spSystemTraceDocumentOnKeyPress,
123fb726d48Sopenharmony_ci  spSystemTraceDocumentOnKeyUp,
124fb726d48Sopenharmony_ci  spSystemTraceDocumentOnMouseDown,
125fb726d48Sopenharmony_ci  spSystemTraceDocumentOnMouseMove,
126fb726d48Sopenharmony_ci  spSystemTraceDocumentOnMouseOut,
127fb726d48Sopenharmony_ci  spSystemTraceDocumentOnMouseUp,
128fb726d48Sopenharmony_ci  spSystemTraceDocumentOnMouseMoveMouseDown,
129fb726d48Sopenharmony_ci} from './SpSystemTrace.event';
130fb726d48Sopenharmony_ciimport { SampleStruct } from '../database/ui-worker/ProcedureWorkerBpftrace';
131fb726d48Sopenharmony_ciimport { readTraceFileBuffer } from '../SpApplicationPublicFunc';
132fb726d48Sopenharmony_ciimport { PerfToolStruct } from '../database/ui-worker/ProcedureWorkerPerfTool';
133fb726d48Sopenharmony_ciimport { BaseStruct } from '../bean/BaseStruct';
134fb726d48Sopenharmony_ciimport { GpuCounterStruct } from '../database/ui-worker/ProcedureWorkerGpuCounter';
135fb726d48Sopenharmony_ciimport { SpProcessChart } from './chart/SpProcessChart';
136fb726d48Sopenharmony_ciimport { LitSearch } from './trace/search/Search';
137fb726d48Sopenharmony_ciimport { LitTable } from '../../base-ui/table/lit-table';
138fb726d48Sopenharmony_ciimport { HangStruct } from '../database/ui-worker/ProcedureWorkerHang';
139fb726d48Sopenharmony_ciimport { SpAiAnalysisPage } from './SpAiAnalysisPage';
140fb726d48Sopenharmony_ci
141fb726d48Sopenharmony_cifunction dpr(): number {
142fb726d48Sopenharmony_ci  return window.devicePixelRatio || 1;
143fb726d48Sopenharmony_ci}
144fb726d48Sopenharmony_ci
145fb726d48Sopenharmony_ciexport class CurrentSlicesTime {
146fb726d48Sopenharmony_ci  startTime: number | undefined;
147fb726d48Sopenharmony_ci  endTime: number | undefined;
148fb726d48Sopenharmony_ci}
149fb726d48Sopenharmony_ci
150fb726d48Sopenharmony_citype HTMLDivElementAlias = HTMLDivElement | undefined | null;
151fb726d48Sopenharmony_citype FlagAlias = Flag | undefined | null;
152fb726d48Sopenharmony_citype SlicesTimeAlias = SlicesTime | undefined | null;
153fb726d48Sopenharmony_ci
154fb726d48Sopenharmony_ci@element('sp-system-trace')
155fb726d48Sopenharmony_ciexport class SpSystemTrace extends BaseElement {
156fb726d48Sopenharmony_ci  mouseCurrentPosition = 0;
157fb726d48Sopenharmony_ci  static isKeyUp: boolean = true;
158fb726d48Sopenharmony_ci  offsetMouse = 0;
159fb726d48Sopenharmony_ci  static isMouseLeftDown = false;
160fb726d48Sopenharmony_ci  static scrollViewWidth = 0;
161fb726d48Sopenharmony_ci  static isCanvasOffScreen = true;
162fb726d48Sopenharmony_ci  static DATA_DICT: Map<number, string> = new Map<number, string>();
163fb726d48Sopenharmony_ci  static DATA_TASK_POOL_CALLSTACK: Map<number, { id: number; ts: number; dur: number; name: string }> = new Map<
164fb726d48Sopenharmony_ci    number,
165fb726d48Sopenharmony_ci    { id: number; ts: number; dur: number; name: string }
166fb726d48Sopenharmony_ci  >();
167fb726d48Sopenharmony_ci  static SDK_CONFIG_MAP: unknown;
168fb726d48Sopenharmony_ci  static sliceRangeMark: unknown;
169fb726d48Sopenharmony_ci  static wakeupList: Array<WakeupBean> = [];
170fb726d48Sopenharmony_ci  static keyPathList: Array<CpuStruct> = [];
171fb726d48Sopenharmony_ci  static keyboardFlar: Boolean = true;
172fb726d48Sopenharmony_ci  static jsProfilerMap: Map<number, unknown> = new Map<number, unknown>();
173fb726d48Sopenharmony_ci  times: Set<number> = new Set<number>();
174fb726d48Sopenharmony_ci  currentSlicesTime: CurrentSlicesTime = new CurrentSlicesTime();
175fb726d48Sopenharmony_ci  intersectionObserver: IntersectionObserver | undefined;
176fb726d48Sopenharmony_ci  tipEL: HTMLDivElementAlias;
177fb726d48Sopenharmony_ci  rowsEL: HTMLDivElementAlias;
178fb726d48Sopenharmony_ci  rowsPaneEL: HTMLDivElementAlias;
179fb726d48Sopenharmony_ci  stateRowsId: Array<object> = [];
180fb726d48Sopenharmony_ci  spacerEL: HTMLDivElementAlias; // @ts-ignore
181fb726d48Sopenharmony_ci  visibleRows: Array<TraceRow<unknown>> = []; // @ts-ignore
182fb726d48Sopenharmony_ci  invisibleRows: Array<TraceRow<unknown>> = []; // @ts-ignore
183fb726d48Sopenharmony_ci  collectRows: Array<TraceRow<unknown>> = []; // @ts-ignore
184fb726d48Sopenharmony_ci  currentRow: TraceRow<unknown> | undefined | null;
185fb726d48Sopenharmony_ci  keyboardEnable = true;
186fb726d48Sopenharmony_ci  mouseEventEnable = true;
187fb726d48Sopenharmony_ci  currentRowType = ''; /*保存当前鼠标所在行的类型*/
188fb726d48Sopenharmony_ci  observerScrollHeightEnable: boolean = false;
189fb726d48Sopenharmony_ci  observerScrollHeightCallback: Function | undefined;
190fb726d48Sopenharmony_ci  favoriteChartListEL: SpChartList | undefined | null;
191fb726d48Sopenharmony_ci  // @ts-ignore
192fb726d48Sopenharmony_ci  observer = new ResizeObserver((entries) => {
193fb726d48Sopenharmony_ci    if (this.observerScrollHeightEnable && this.observerScrollHeightCallback) {
194fb726d48Sopenharmony_ci      this.observerScrollHeightCallback();
195fb726d48Sopenharmony_ci    }
196fb726d48Sopenharmony_ci  });
197fb726d48Sopenharmony_ci  static btnTimer: unknown = null;
198fb726d48Sopenharmony_ci  isMousePointInSheet = false;
199fb726d48Sopenharmony_ci  hoverFlag: FlagAlias;
200fb726d48Sopenharmony_ci  selectFlag: FlagAlias;
201fb726d48Sopenharmony_ci  slicestime: SlicesTimeAlias;
202fb726d48Sopenharmony_ci  public timerShaftEL: TimerShaftElement | null | undefined;
203fb726d48Sopenharmony_ci  public traceSheetEL: TraceSheet | undefined | null;
204fb726d48Sopenharmony_ci  public rangeSelect!: RangeSelect;
205fb726d48Sopenharmony_ci  chartManager: SpChartManager | undefined | null;
206fb726d48Sopenharmony_ci  loadTraceCompleted: boolean = false; // @ts-ignore
207fb726d48Sopenharmony_ci  rangeTraceRow: Array<TraceRow<unknown>> | undefined = [];
208fb726d48Sopenharmony_ci  canvasFavoritePanelCtx: CanvasRenderingContext2D | null | undefined;
209fb726d48Sopenharmony_ci  canvasPanel: HTMLCanvasElement | null | undefined; //绘制取消收藏后泳道图
210fb726d48Sopenharmony_ci  canvasPanelCtx: CanvasRenderingContext2D | undefined | null;
211fb726d48Sopenharmony_ci  linkNodes: PairPoint[][] = [];
212fb726d48Sopenharmony_ci  public currentClickRow: HTMLDivElement | undefined | null;
213fb726d48Sopenharmony_ci  private litTabs: LitTabs | undefined | null;
214fb726d48Sopenharmony_ci  eventMap: unknown = {};
215fb726d48Sopenharmony_ci  isSelectClick: boolean = false;
216fb726d48Sopenharmony_ci  selectionParam: SelectionParam | undefined;
217fb726d48Sopenharmony_ci  snapshotFiles: FileInfo | null | undefined;
218fb726d48Sopenharmony_ci  tabCpuFreq: TabPaneFrequencySample | undefined | null;
219fb726d48Sopenharmony_ci  tabCpuState: TabPaneCounterSample | undefined | null;
220fb726d48Sopenharmony_ci  collapseAll: boolean = false;
221fb726d48Sopenharmony_ci  currentCollectGroup: string = '1';
222fb726d48Sopenharmony_ci  private _list: Array<SlicesTime> = [];
223fb726d48Sopenharmony_ci  static isHiddenMenu: boolean = false; // @ts-ignore
224fb726d48Sopenharmony_ci  expandRowList: Array<TraceRow<unknown>> = [];
225fb726d48Sopenharmony_ci  _slicesList: Array<SlicesTime> = [];
226fb726d48Sopenharmony_ci  _flagList: Array<unknown> = [];
227fb726d48Sopenharmony_ci  static currentStartTime: number = 0;
228fb726d48Sopenharmony_ci  static retargetIndex: number = 0;
229fb726d48Sopenharmony_ci  prevScrollY: number = 0;
230fb726d48Sopenharmony_ci  wakeupListTbl: LitTable | undefined | null;
231fb726d48Sopenharmony_ci  _checkclick: boolean = false; //判断点击getWakeupList按钮
232fb726d48Sopenharmony_ci  docomList: Array<number> = [];
233fb726d48Sopenharmony_ci  repaintList: Array<number> = [];
234fb726d48Sopenharmony_ci  presentList: Array<number> = [];
235fb726d48Sopenharmony_ci  static isAiAsk: boolean = false;
236fb726d48Sopenharmony_ci
237fb726d48Sopenharmony_ci  set snapshotFile(data: FileInfo) {
238fb726d48Sopenharmony_ci    this.snapshotFiles = data;
239fb726d48Sopenharmony_ci  }
240fb726d48Sopenharmony_ci
241fb726d48Sopenharmony_ci  set slicesList(list: Array<SlicesTime>) {
242fb726d48Sopenharmony_ci    this._slicesList = list;
243fb726d48Sopenharmony_ci  }
244fb726d48Sopenharmony_ci
245fb726d48Sopenharmony_ci  set flagList(list: Array<unknown>) {
246fb726d48Sopenharmony_ci    this._flagList = list;
247fb726d48Sopenharmony_ci  }
248fb726d48Sopenharmony_ci
249fb726d48Sopenharmony_ci  get checkclick(): boolean {
250fb726d48Sopenharmony_ci    return this._checkclick;
251fb726d48Sopenharmony_ci  }
252fb726d48Sopenharmony_ci
253fb726d48Sopenharmony_ci  set checkclick(value: boolean) {
254fb726d48Sopenharmony_ci    if (value) {
255fb726d48Sopenharmony_ci      this._checkclick = true;
256fb726d48Sopenharmony_ci    } else {
257fb726d48Sopenharmony_ci      this._checkclick = false;
258fb726d48Sopenharmony_ci    }
259fb726d48Sopenharmony_ci  }
260fb726d48Sopenharmony_ci
261fb726d48Sopenharmony_ci  //节流处理
262fb726d48Sopenharmony_ci  throttle(fn: Function, t: number, ev?: unknown): Function {
263fb726d48Sopenharmony_ci    let timerId: unknown = null;
264fb726d48Sopenharmony_ci    return (): void => {
265fb726d48Sopenharmony_ci      if (!timerId) {
266fb726d48Sopenharmony_ci        timerId = setTimeout(function (): void {
267fb726d48Sopenharmony_ci          if (ev) {
268fb726d48Sopenharmony_ci            fn(ev);
269fb726d48Sopenharmony_ci          } else {
270fb726d48Sopenharmony_ci            fn();
271fb726d48Sopenharmony_ci          }
272fb726d48Sopenharmony_ci          timerId = null;
273fb726d48Sopenharmony_ci        }, t); // @ts-ignore
274fb726d48Sopenharmony_ci        this.times.add(timerId);
275fb726d48Sopenharmony_ci      }
276fb726d48Sopenharmony_ci    };
277fb726d48Sopenharmony_ci  }
278fb726d48Sopenharmony_ci
279fb726d48Sopenharmony_ci  // 防抖处理
280fb726d48Sopenharmony_ci  debounce(fn: Function, ms: number, ev?: unknown): Function {
281fb726d48Sopenharmony_ci    let timerId: undefined | number;
282fb726d48Sopenharmony_ci    return (): void => {
283fb726d48Sopenharmony_ci      if (timerId) {
284fb726d48Sopenharmony_ci        window.clearTimeout(timerId);
285fb726d48Sopenharmony_ci      } else {
286fb726d48Sopenharmony_ci        timerId = window.setTimeout((): void => {
287fb726d48Sopenharmony_ci          if (ev) {
288fb726d48Sopenharmony_ci            fn(ev);
289fb726d48Sopenharmony_ci          } else {
290fb726d48Sopenharmony_ci            fn();
291fb726d48Sopenharmony_ci          }
292fb726d48Sopenharmony_ci          timerId = undefined;
293fb726d48Sopenharmony_ci        }, ms);
294fb726d48Sopenharmony_ci        this.times.add(timerId);
295fb726d48Sopenharmony_ci      }
296fb726d48Sopenharmony_ci    };
297fb726d48Sopenharmony_ci  }
298fb726d48Sopenharmony_ci
299fb726d48Sopenharmony_ci  addPointPair(startPoint: PairPoint, endPoint: PairPoint, lineType?: string): void {
300fb726d48Sopenharmony_ci    if (startPoint !== null && startPoint.rowEL !== null && endPoint !== null && endPoint.rowEL !== null) {
301fb726d48Sopenharmony_ci      if (startPoint.rowEL.collect) {
302fb726d48Sopenharmony_ci        if (this.timerShaftEL?._checkExpand) {
303fb726d48Sopenharmony_ci          startPoint.rowEL.translateY =
304fb726d48Sopenharmony_ci            startPoint.rowEL.getBoundingClientRect().top - 195 + this.timerShaftEL._usageFoldHeight!;
305fb726d48Sopenharmony_ci        } else {
306fb726d48Sopenharmony_ci          startPoint.rowEL.translateY = startPoint.rowEL.getBoundingClientRect().top - 195;
307fb726d48Sopenharmony_ci        }
308fb726d48Sopenharmony_ci      } else {
309fb726d48Sopenharmony_ci        startPoint.rowEL.translateY = startPoint.rowEL.offsetTop - this.rowsPaneEL!.scrollTop;
310fb726d48Sopenharmony_ci      }
311fb726d48Sopenharmony_ci      if (endPoint.rowEL.collect) {
312fb726d48Sopenharmony_ci        endPoint.rowEL.translateY = endPoint.rowEL.getBoundingClientRect().top - 195;
313fb726d48Sopenharmony_ci      } else {
314fb726d48Sopenharmony_ci        endPoint.rowEL.translateY = endPoint.rowEL.offsetTop - this.rowsPaneEL!.scrollTop;
315fb726d48Sopenharmony_ci      }
316fb726d48Sopenharmony_ci      startPoint.y = startPoint.rowEL!.translateY! + startPoint.offsetY;
317fb726d48Sopenharmony_ci      endPoint.y = endPoint.rowEL!.translateY! + endPoint.offsetY;
318fb726d48Sopenharmony_ci      startPoint.backrowEL = startPoint.rowEL;
319fb726d48Sopenharmony_ci      endPoint.backrowEL = endPoint.rowEL;
320fb726d48Sopenharmony_ci      //判断是否是分布式连线,分布式连线需有rangeTime
321fb726d48Sopenharmony_ci      if (!lineType) {
322fb726d48Sopenharmony_ci        this.linkNodes.push([startPoint, endPoint]);
323fb726d48Sopenharmony_ci      } else {
324fb726d48Sopenharmony_ci        if (startPoint.rangeTime) {
325fb726d48Sopenharmony_ci          this.linkNodes.push([startPoint, endPoint]);
326fb726d48Sopenharmony_ci        }
327fb726d48Sopenharmony_ci      }
328fb726d48Sopenharmony_ci      this.refreshCanvas(true);
329fb726d48Sopenharmony_ci    }
330fb726d48Sopenharmony_ci  }
331fb726d48Sopenharmony_ci
332fb726d48Sopenharmony_ci  clearPointPair(): void {
333fb726d48Sopenharmony_ci    this.linkNodes.length = 0;
334fb726d48Sopenharmony_ci  }
335fb726d48Sopenharmony_ci
336fb726d48Sopenharmony_ci  removeLinkLinesByBusinessType(...businessTypes: string[]): void {
337fb726d48Sopenharmony_ci    this.linkNodes = this.linkNodes.filter((pointPair) => {
338fb726d48Sopenharmony_ci      if (businessTypes.indexOf('distributed') >= 0) {
339fb726d48Sopenharmony_ci        FuncStruct.selectLineFuncStruct = [];
340fb726d48Sopenharmony_ci      }
341fb726d48Sopenharmony_ci      return businessTypes.indexOf(pointPair[0].business) <= -1;
342fb726d48Sopenharmony_ci    });
343fb726d48Sopenharmony_ci  }
344fb726d48Sopenharmony_ci
345fb726d48Sopenharmony_ci  hiddenLinkLinesByBusinessType(...businessTypes: string[]): void {
346fb726d48Sopenharmony_ci    this.linkNodes.map((value) => {
347fb726d48Sopenharmony_ci      if (businessTypes.indexOf(value[0].business) !== -1) {
348fb726d48Sopenharmony_ci        value[0].hidden = true;
349fb726d48Sopenharmony_ci        value[1].hidden = true;
350fb726d48Sopenharmony_ci      }
351fb726d48Sopenharmony_ci    });
352fb726d48Sopenharmony_ci  }
353fb726d48Sopenharmony_ci
354fb726d48Sopenharmony_ci  showLinkLinesByBusinessType(...businessTypes: string[]): void {
355fb726d48Sopenharmony_ci    this.linkNodes.map((value) => {
356fb726d48Sopenharmony_ci      if (businessTypes.indexOf(value[0].business) !== -1) {
357fb726d48Sopenharmony_ci        value[0].hidden = false;
358fb726d48Sopenharmony_ci        value[1].hidden = false;
359fb726d48Sopenharmony_ci      }
360fb726d48Sopenharmony_ci    });
361fb726d48Sopenharmony_ci  }
362fb726d48Sopenharmony_ci
363fb726d48Sopenharmony_ci  initElements(): void {
364fb726d48Sopenharmony_ci    spSystemTraceInitElement(this);
365fb726d48Sopenharmony_ci  }
366fb726d48Sopenharmony_ci
367fb726d48Sopenharmony_ci  // 清除上一次点击调用栈产生的三角旗子
368fb726d48Sopenharmony_ci  clearTriangle(flagList: Array<Flag>): void {
369fb726d48Sopenharmony_ci    this.timerShaftEL!.sportRuler!.times = [];
370fb726d48Sopenharmony_ci    for (let i = 0; i < flagList.length; i++) {
371fb726d48Sopenharmony_ci      if (flagList[i].type === 'triangle') {
372fb726d48Sopenharmony_ci        flagList.splice(i, 1);
373fb726d48Sopenharmony_ci        this.timerShaftELFlagChange(this.hoverFlag, null);
374fb726d48Sopenharmony_ci        i--;
375fb726d48Sopenharmony_ci      }
376fb726d48Sopenharmony_ci    }
377fb726d48Sopenharmony_ci  }
378fb726d48Sopenharmony_ci
379fb726d48Sopenharmony_ci  pushPidToSelection(selection: SelectionParam, id: string, originalId?: string | Array<string>): void {
380fb726d48Sopenharmony_ci    let add = (it: string): void => {
381fb726d48Sopenharmony_ci      let pid = parseInt(it ? it : id);
382fb726d48Sopenharmony_ci      if (!isNaN(pid!)) {
383fb726d48Sopenharmony_ci        if (!selection.processIds.includes(pid!)) {
384fb726d48Sopenharmony_ci          selection.processIds.push(pid!);
385fb726d48Sopenharmony_ci        }
386fb726d48Sopenharmony_ci      }
387fb726d48Sopenharmony_ci    };
388fb726d48Sopenharmony_ci    if (Array.isArray(originalId)) {
389fb726d48Sopenharmony_ci      originalId.forEach(item => {
390fb726d48Sopenharmony_ci        add(item);
391fb726d48Sopenharmony_ci      });
392fb726d48Sopenharmony_ci    } else {
393fb726d48Sopenharmony_ci      add(originalId!);
394fb726d48Sopenharmony_ci    }
395fb726d48Sopenharmony_ci  }
396fb726d48Sopenharmony_ci  // @ts-ignore
397fb726d48Sopenharmony_ci  getCollectRows(condition: (row: TraceRow<unknown>) => boolean): Array<TraceRow<unknown>> {
398fb726d48Sopenharmony_ci    return this.favoriteChartListEL!.getCollectRows(condition);
399fb726d48Sopenharmony_ci  }
400fb726d48Sopenharmony_ci  // @ts-ignore
401fb726d48Sopenharmony_ci  createPointEvent(it: TraceRow<unknown>): unknown {
402fb726d48Sopenharmony_ci    // @ts-ignore
403fb726d48Sopenharmony_ci    let event = this.eventMap[`${it.rowType}`];
404fb726d48Sopenharmony_ci    if (event) {
405fb726d48Sopenharmony_ci      return event;
406fb726d48Sopenharmony_ci    } else {
407fb726d48Sopenharmony_ci      if (it.rowType === TraceRow.ROW_TYPE_HEAP) {
408fb726d48Sopenharmony_ci        event = it.name;
409fb726d48Sopenharmony_ci      } else if (it.rowType === TraceRow.ROW_TYPE_HIPERF_CPU) {
410fb726d48Sopenharmony_ci        event = 'HiPerf Cpu';
411fb726d48Sopenharmony_ci        if (it.rowId === 'HiPerf-cpu-merge') {
412fb726d48Sopenharmony_ci          event = 'HiPerf';
413fb726d48Sopenharmony_ci        }
414fb726d48Sopenharmony_ci      } else if (it.rowType === TraceRow.ROW_TYPE_FILE_SYSTEM) {
415fb726d48Sopenharmony_ci        event = this.handleFileSystemType(it, event);
416fb726d48Sopenharmony_ci      } else if (it.rowType === TraceRow.ROW_TYPE_STATE_ENERGY) {
417fb726d48Sopenharmony_ci        event = it.name;
418fb726d48Sopenharmony_ci      } else if (it.rowType === TraceRow.ROW_TYPE_VM_TRACKER) {
419fb726d48Sopenharmony_ci        if (it.rowParentId === '') {
420fb726d48Sopenharmony_ci          event = 'VM Tracker';
421fb726d48Sopenharmony_ci        } else {
422fb726d48Sopenharmony_ci          event = it.name;
423fb726d48Sopenharmony_ci        }
424fb726d48Sopenharmony_ci      } else if (it.rowType === TraceRow.ROW_TYPE_JANK) {
425fb726d48Sopenharmony_ci        if (it.rowId === 'frameTime' || it.rowParentId === 'frameTime') {
426fb726d48Sopenharmony_ci          event = 'FrameTimeLine';
427fb726d48Sopenharmony_ci        } else if (it.hasAttribute('frame_type')) {
428fb726d48Sopenharmony_ci          event = `${it.getAttribute('frame_type')}`;
429fb726d48Sopenharmony_ci        }
430fb726d48Sopenharmony_ci      } else if (it.rowType === TraceRow.ROW_TYPE_DELIVER_INPUT_EVENT) {
431fb726d48Sopenharmony_ci        event = 'DeliverInputEvent';
432fb726d48Sopenharmony_ci        if (it.rowParentId === TraceRow.ROW_TYPE_DELIVER_INPUT_EVENT) {
433fb726d48Sopenharmony_ci          event = 'DeliverInputEvent Func';
434fb726d48Sopenharmony_ci        }
435fb726d48Sopenharmony_ci      } else if (it.rowType === TraceRow.ROW_TYPE_TOUCH_EVENT_DISPATCH) {
436fb726d48Sopenharmony_ci        event = 'TouchEventDispatch';
437fb726d48Sopenharmony_ci        if (it.rowParentId === TraceRow.ROW_TYPE_TOUCH_EVENT_DISPATCH) {
438fb726d48Sopenharmony_ci          event = 'TouchEventDispatch Func';
439fb726d48Sopenharmony_ci        }
440fb726d48Sopenharmony_ci      } else {
441fb726d48Sopenharmony_ci        event = it.name;
442fb726d48Sopenharmony_ci      }
443fb726d48Sopenharmony_ci      return event;
444fb726d48Sopenharmony_ci    }
445fb726d48Sopenharmony_ci  }
446fb726d48Sopenharmony_ci  // @ts-ignore
447fb726d48Sopenharmony_ci  private handleFileSystemType(it: TraceRow<unknown>, event: unknown): void {
448fb726d48Sopenharmony_ci    if (it.rowId === 'FileSystemLogicalWrite') {
449fb726d48Sopenharmony_ci      event = 'FileSystem Logical Write';
450fb726d48Sopenharmony_ci    } else if (it.rowId === 'FileSystemLogicalRead') {
451fb726d48Sopenharmony_ci      event = 'FileSystem Logical Read';
452fb726d48Sopenharmony_ci    } else if (it.rowId === 'FileSystemVirtualMemory') {
453fb726d48Sopenharmony_ci      event = 'Page Fault Trace';
454fb726d48Sopenharmony_ci    } else if (it.rowId!.startsWith('FileSystemDiskIOLatency')) {
455fb726d48Sopenharmony_ci      event = 'Disk I/O Latency';
456fb726d48Sopenharmony_ci      if (it.rowId!.startsWith('FileSystemDiskIOLatency-')) {
457fb726d48Sopenharmony_ci        event = 'Bio Process';
458fb726d48Sopenharmony_ci      }
459fb726d48Sopenharmony_ci    } // @ts-ignore
460fb726d48Sopenharmony_ci    return event;
461fb726d48Sopenharmony_ci  }
462fb726d48Sopenharmony_ci
463fb726d48Sopenharmony_ci  refreshFavoriteCanvas(): void {
464fb726d48Sopenharmony_ci    this.favoriteChartListEL!.refreshFavoriteCanvas();
465fb726d48Sopenharmony_ci  }
466fb726d48Sopenharmony_ci  // @ts-ignore
467fb726d48Sopenharmony_ci  expansionAllParentRow(currentRow: TraceRow<unknown>): void {
468fb726d48Sopenharmony_ci    // @ts-ignore
469fb726d48Sopenharmony_ci    let parentRow = this.rowsEL!.querySelector<TraceRow<unknown>>(
470fb726d48Sopenharmony_ci      `trace-row[row-id='${currentRow.rowParentId}'][folder][scene]`
471fb726d48Sopenharmony_ci    );
472fb726d48Sopenharmony_ci    if (parentRow) {
473fb726d48Sopenharmony_ci      parentRow.expansion = true; // @ts-ignore
474fb726d48Sopenharmony_ci      if (this.rowsEL!.querySelector<TraceRow<unknown>>(`trace-row[row-id='${parentRow.rowParentId}'][folder]`)) {
475fb726d48Sopenharmony_ci        this.expansionAllParentRow(parentRow);
476fb726d48Sopenharmony_ci      }
477fb726d48Sopenharmony_ci    }
478fb726d48Sopenharmony_ci  }
479fb726d48Sopenharmony_ci
480fb726d48Sopenharmony_ci  canvasPanelConfig(): void {
481fb726d48Sopenharmony_ci    this.canvasPanel!.style.left = `${this.timerShaftEL!.canvas!.offsetLeft!}px`;
482fb726d48Sopenharmony_ci    this.canvasPanel!.width = this.canvasPanel!.offsetWidth * dpr();
483fb726d48Sopenharmony_ci    this.canvasPanel!.height = this.canvasPanel!.offsetHeight * dpr();
484fb726d48Sopenharmony_ci    this.canvasPanelCtx!.scale(dpr(), dpr());
485fb726d48Sopenharmony_ci  }
486fb726d48Sopenharmony_ci
487fb726d48Sopenharmony_ci  getScrollWidth(): number {
488fb726d48Sopenharmony_ci    let overflowDiv = document.createElement('div');
489fb726d48Sopenharmony_ci    overflowDiv.style.cssText = 'position:absolute; top:-2000px;width:200px; height:200px; overflow:hidden;';
490fb726d48Sopenharmony_ci    let totalScrollDiv = document.body.appendChild(overflowDiv).clientWidth;
491fb726d48Sopenharmony_ci    overflowDiv.style.overflowY = 'scroll';
492fb726d48Sopenharmony_ci    let scrollDiv = overflowDiv.clientWidth;
493fb726d48Sopenharmony_ci    document.body.removeChild(overflowDiv);
494fb726d48Sopenharmony_ci    return totalScrollDiv - scrollDiv;
495fb726d48Sopenharmony_ci  }
496fb726d48Sopenharmony_ci
497fb726d48Sopenharmony_ci  getShowTab(): Array<string> {
498fb726d48Sopenharmony_ci    let tabpane = this.traceSheetEL!.shadowRoot!.querySelectorAll('lit-tabpane') as NodeListOf<LitTabpane>;
499fb726d48Sopenharmony_ci    let showTab: Array<string> = [];
500fb726d48Sopenharmony_ci    for (let pane of tabpane) {
501fb726d48Sopenharmony_ci      if (pane.getAttribute('hidden') === 'false') {
502fb726d48Sopenharmony_ci        showTab.push(pane.getAttribute('id') || '');
503fb726d48Sopenharmony_ci      }
504fb726d48Sopenharmony_ci    }
505fb726d48Sopenharmony_ci    return showTab;
506fb726d48Sopenharmony_ci  }
507fb726d48Sopenharmony_ci
508fb726d48Sopenharmony_ci  timerShaftELFlagClickHandler = (flag: FlagAlias): void => {
509fb726d48Sopenharmony_ci    if (flag) {
510fb726d48Sopenharmony_ci      setTimeout(() => {
511fb726d48Sopenharmony_ci        if (TraceRow.rangeSelectObject) {
512fb726d48Sopenharmony_ci          let showTab = this.getShowTab();
513fb726d48Sopenharmony_ci          this.traceSheetEL?.displayTab<TabPaneFlag>('box-flag', ...showTab).setCurrentFlag(flag);
514fb726d48Sopenharmony_ci        } else {
515fb726d48Sopenharmony_ci          this.traceSheetEL?.displayTab<TabPaneFlag>('box-flag').setCurrentFlag(flag);
516fb726d48Sopenharmony_ci        }
517fb726d48Sopenharmony_ci      }, 100);
518fb726d48Sopenharmony_ci    }
519fb726d48Sopenharmony_ci  };
520fb726d48Sopenharmony_ci
521fb726d48Sopenharmony_ci  timerShaftELFlagChange = (hoverFlag: FlagAlias, selectFlag: FlagAlias): void => {
522fb726d48Sopenharmony_ci    this.hoverFlag = hoverFlag;
523fb726d48Sopenharmony_ci    this.selectFlag = selectFlag;
524fb726d48Sopenharmony_ci    this.refreshCanvas(true, 'flagChange');
525fb726d48Sopenharmony_ci  };
526fb726d48Sopenharmony_ci
527fb726d48Sopenharmony_ci  timerShaftELRangeClick = (sliceTime: SlicesTimeAlias): void => {
528fb726d48Sopenharmony_ci    if (sliceTime) {
529fb726d48Sopenharmony_ci      setTimeout(() => {
530fb726d48Sopenharmony_ci        if (TraceRow.rangeSelectObject) {
531fb726d48Sopenharmony_ci          let showTab = this.getShowTab();
532fb726d48Sopenharmony_ci          this.traceSheetEL?.displayTab<TabPaneCurrent>('tabpane-current', ...showTab).setCurrentSlicesTime(sliceTime);
533fb726d48Sopenharmony_ci        } else {
534fb726d48Sopenharmony_ci          this.traceSheetEL?.displayTab<TabPaneCurrent>('tabpane-current').setCurrentSlicesTime(sliceTime);
535fb726d48Sopenharmony_ci        }
536fb726d48Sopenharmony_ci      }, 0);
537fb726d48Sopenharmony_ci    }
538fb726d48Sopenharmony_ci  };
539fb726d48Sopenharmony_ci
540fb726d48Sopenharmony_ci  timerShaftELRangeChange = (e: unknown): void => {
541fb726d48Sopenharmony_ci    // @ts-ignore
542fb726d48Sopenharmony_ci    TraceRow.range = e;
543fb726d48Sopenharmony_ci    if (TraceRow.rangeSelectObject) {
544fb726d48Sopenharmony_ci      TraceRow.rangeSelectObject!.startX = Math.floor(
545fb726d48Sopenharmony_ci        ns2x(
546fb726d48Sopenharmony_ci          TraceRow.rangeSelectObject!.startNS!,
547fb726d48Sopenharmony_ci          TraceRow.range?.startNS!,
548fb726d48Sopenharmony_ci          TraceRow.range?.endNS!,
549fb726d48Sopenharmony_ci          TraceRow.range?.totalNS!,
550fb726d48Sopenharmony_ci          this.timerShaftEL!.sportRuler!.frame
551fb726d48Sopenharmony_ci        )
552fb726d48Sopenharmony_ci      );
553fb726d48Sopenharmony_ci      TraceRow.rangeSelectObject!.endX = Math.floor(
554fb726d48Sopenharmony_ci        ns2x(
555fb726d48Sopenharmony_ci          TraceRow.rangeSelectObject!.endNS!,
556fb726d48Sopenharmony_ci          TraceRow.range?.startNS!,
557fb726d48Sopenharmony_ci          TraceRow.range?.endNS!,
558fb726d48Sopenharmony_ci          TraceRow.range?.totalNS!,
559fb726d48Sopenharmony_ci          this.timerShaftEL!.sportRuler!.frame
560fb726d48Sopenharmony_ci        )
561fb726d48Sopenharmony_ci      );
562fb726d48Sopenharmony_ci    }
563fb726d48Sopenharmony_ci    if (!TraceRow.rangeSelectObject && !this.isSlectStruct()) {
564fb726d48Sopenharmony_ci      SpAiAnalysisPage.selectChangeListener(TraceRow.range?.startNS!, TraceRow.range?.endNS!)
565fb726d48Sopenharmony_ci    }
566fb726d48Sopenharmony_ci    //在rowsEL显示范围内的 trace-row组件将收到时间区间变化通知
567fb726d48Sopenharmony_ci    this.linkNodes.forEach((it) => {
568fb726d48Sopenharmony_ci      it[0].x = ns2xByTimeShaft(it[0].ns, this.timerShaftEL!);
569fb726d48Sopenharmony_ci      it[1].x = ns2xByTimeShaft(it[1].ns, this.timerShaftEL!);
570fb726d48Sopenharmony_ci    });
571fb726d48Sopenharmony_ci    this.invisibleRows.forEach((it) => (it.needRefresh = true));
572fb726d48Sopenharmony_ci    this.visibleRows.forEach((it) => (it.needRefresh = true));
573fb726d48Sopenharmony_ci    this.refreshCanvas(false, 'rangeChange');
574fb726d48Sopenharmony_ci  };
575fb726d48Sopenharmony_ci  isSlectStruct() {
576fb726d48Sopenharmony_ci    return CpuStruct.selectCpuStruct ||
577fb726d48Sopenharmony_ci      CpuStruct.wakeupBean ||
578fb726d48Sopenharmony_ci      CpuFreqStruct.selectCpuFreqStruct ||
579fb726d48Sopenharmony_ci      ThreadStruct.selectThreadStruct ||
580fb726d48Sopenharmony_ci      ThreadStruct.isClickPrio ||
581fb726d48Sopenharmony_ci      FuncStruct.selectFuncStruct ||
582fb726d48Sopenharmony_ci      SpHiPerf.selectCpuStruct ||
583fb726d48Sopenharmony_ci      CpuStateStruct.selectStateStruct ||
584fb726d48Sopenharmony_ci      CpuFreqLimitsStruct.selectCpuFreqLimitsStruct ||
585fb726d48Sopenharmony_ci      ClockStruct.selectClockStruct ||
586fb726d48Sopenharmony_ci      IrqStruct.selectIrqStruct ||
587fb726d48Sopenharmony_ci      JankStruct.selectJankStruct ||
588fb726d48Sopenharmony_ci      HeapStruct.selectHeapStruct ||
589fb726d48Sopenharmony_ci      AppStartupStruct.selectStartupStruct ||
590fb726d48Sopenharmony_ci      SoStruct.selectSoStruct ||
591fb726d48Sopenharmony_ci      HeapSnapshotStruct.selectSnapshotStruct ||
592fb726d48Sopenharmony_ci      FrameSpacingStruct.selectFrameSpacingStruct ||
593fb726d48Sopenharmony_ci      FrameAnimationStruct.selectFrameAnimationStruct ||
594fb726d48Sopenharmony_ci      FrameDynamicStruct.selectFrameDynamicStruct ||
595fb726d48Sopenharmony_ci      JsCpuProfilerStruct.selectJsCpuProfilerStruct ||
596fb726d48Sopenharmony_ci      SnapshotStruct.selectSnapshotStruct ||
597fb726d48Sopenharmony_ci      HiPerfCallChartStruct.selectStruct ||
598fb726d48Sopenharmony_ci      AllAppStartupStruct.selectStartupStruct ||
599fb726d48Sopenharmony_ci      LtpoStruct.selectLtpoStruct ||
600fb726d48Sopenharmony_ci      HitchTimeStruct.selectHitchTimeStruct ||
601fb726d48Sopenharmony_ci      SampleStruct.selectSampleStruct ||
602fb726d48Sopenharmony_ci      PerfToolStruct.selectPerfToolStruct ||
603fb726d48Sopenharmony_ci      GpuCounterStruct.selectGpuCounterStruct ||
604fb726d48Sopenharmony_ci      DmaFenceStruct.selectDmaFenceStruct;
605fb726d48Sopenharmony_ci  }
606fb726d48Sopenharmony_ci  top: number = 0;
607fb726d48Sopenharmony_ci  handler: number = -1;
608fb726d48Sopenharmony_ci  rowsElOnScroll = (e: unknown): void => {
609fb726d48Sopenharmony_ci    // @ts-ignore
610fb726d48Sopenharmony_ci    const currentScrollY = e.target.scrollTop;
611fb726d48Sopenharmony_ci    const deltaY = currentScrollY - this.prevScrollY;
612fb726d48Sopenharmony_ci    this.linkNodes.forEach((itln) => {
613fb726d48Sopenharmony_ci      if (itln[0].rowEL.collect) {
614fb726d48Sopenharmony_ci        if (this.timerShaftEL?._checkExpand) {
615fb726d48Sopenharmony_ci          itln[0].rowEL.translateY =
616fb726d48Sopenharmony_ci            itln[0].rowEL.getBoundingClientRect().top - 195 + this.timerShaftEL._usageFoldHeight!;
617fb726d48Sopenharmony_ci        } else {
618fb726d48Sopenharmony_ci          itln[0].rowEL.translateY = itln[0].rowEL.getBoundingClientRect().top - 195;
619fb726d48Sopenharmony_ci        }
620fb726d48Sopenharmony_ci      } else {
621fb726d48Sopenharmony_ci        itln[0].rowEL.translateY = itln[0].rowEL.offsetTop - this.rowsPaneEL!.scrollTop;
622fb726d48Sopenharmony_ci      }
623fb726d48Sopenharmony_ci      if (itln[1].rowEL.collect) {
624fb726d48Sopenharmony_ci        if (this.timerShaftEL?._checkExpand) {
625fb726d48Sopenharmony_ci          itln[1].rowEL.translateY =
626fb726d48Sopenharmony_ci            itln[1].rowEL.getBoundingClientRect().top - 195 + this.timerShaftEL._usageFoldHeight!;
627fb726d48Sopenharmony_ci        } else {
628fb726d48Sopenharmony_ci          itln[1].rowEL.translateY = itln[1].rowEL.getBoundingClientRect().top - 195;
629fb726d48Sopenharmony_ci        }
630fb726d48Sopenharmony_ci      } else {
631fb726d48Sopenharmony_ci        itln[1].rowEL.translateY = itln[1].rowEL.offsetTop - this.rowsPaneEL!.scrollTop;
632fb726d48Sopenharmony_ci      }
633fb726d48Sopenharmony_ci      itln[0].y = itln[0].rowEL.translateY + itln[0].offsetY;
634fb726d48Sopenharmony_ci      itln[1].y = itln[1].rowEL.translateY + itln[1].offsetY;
635fb726d48Sopenharmony_ci    });
636fb726d48Sopenharmony_ci    this.hoverStructNull();
637fb726d48Sopenharmony_ci    if (this.scrollTimer) {
638fb726d48Sopenharmony_ci      // @ts-ignore
639fb726d48Sopenharmony_ci      clearTimeout(this.scrollTimer);
640fb726d48Sopenharmony_ci    }
641fb726d48Sopenharmony_ci    this.scrollTimer = setTimeout(() => {
642fb726d48Sopenharmony_ci      TraceRow.range!.refresh = true;
643fb726d48Sopenharmony_ci      requestAnimationFrame(() => this.refreshCanvas(false));
644fb726d48Sopenharmony_ci    }, 200);
645fb726d48Sopenharmony_ci    spSystemTraceParentRowSticky(this, deltaY);
646fb726d48Sopenharmony_ci    this.prevScrollY = currentScrollY;
647fb726d48Sopenharmony_ci  };
648fb726d48Sopenharmony_ci
649fb726d48Sopenharmony_ci  private scrollTimer: unknown;
650fb726d48Sopenharmony_ci
651fb726d48Sopenharmony_ci  favoriteRowsElOnScroll = (e: unknown): void => {
652fb726d48Sopenharmony_ci    this.rowsElOnScroll(e);
653fb726d48Sopenharmony_ci  };
654fb726d48Sopenharmony_ci
655fb726d48Sopenharmony_ci  offset = 147;
656fb726d48Sopenharmony_ci
657fb726d48Sopenharmony_ci  getRowsContentHeight(): number {
658fb726d48Sopenharmony_ci    // @ts-ignore
659fb726d48Sopenharmony_ci    return [...this.rowsEL!.querySelectorAll<TraceRow<unknown>>('trace-row:not([sleeping])')]
660fb726d48Sopenharmony_ci      .map((it) => it.clientHeight)
661fb726d48Sopenharmony_ci      .reduce((acr, cur) => acr + cur, 0);
662fb726d48Sopenharmony_ci  }
663fb726d48Sopenharmony_ci
664fb726d48Sopenharmony_ci  // refresh main canvas and favorite canvas
665fb726d48Sopenharmony_ci  refreshCanvas(cache: boolean, from?: string): void {
666fb726d48Sopenharmony_ci    if (this.visibleRows.length === 0) {
667fb726d48Sopenharmony_ci      return;
668fb726d48Sopenharmony_ci    }
669fb726d48Sopenharmony_ci    //clear main canvas
670fb726d48Sopenharmony_ci    this.canvasPanelCtx!.clearRect(0, 0, this.canvasPanel!.offsetWidth, this.canvasPanel!.offsetHeight);
671fb726d48Sopenharmony_ci    this.favoriteChartListEL!.clearRect();
672fb726d48Sopenharmony_ci    //draw lines for main canvas
673fb726d48Sopenharmony_ci    let rowsContentHeight = this.getRowsContentHeight();
674fb726d48Sopenharmony_ci    let canvasHeight =
675fb726d48Sopenharmony_ci      rowsContentHeight > this.canvasPanel!.clientHeight ? this.canvasPanel!.clientHeight : rowsContentHeight;
676fb726d48Sopenharmony_ci    drawLines(this.canvasPanelCtx!, TraceRow.range?.xs || [], canvasHeight, this.timerShaftEL!.lineColor());
677fb726d48Sopenharmony_ci    //draw lines for favorite canvas
678fb726d48Sopenharmony_ci    this.favoriteChartListEL?.drawLines(TraceRow.range?.xs, this.timerShaftEL!.lineColor()); // chart list
679fb726d48Sopenharmony_ci
680fb726d48Sopenharmony_ci    //canvas translate
681fb726d48Sopenharmony_ci    this.canvasPanel!.style.transform = `translateY(${this.rowsPaneEL!.scrollTop}px)`;
682fb726d48Sopenharmony_ci    //draw trace row
683fb726d48Sopenharmony_ci    this.visibleRows.forEach((v, i) => {
684fb726d48Sopenharmony_ci      if (v.collect) {
685fb726d48Sopenharmony_ci        v.translateY =
686fb726d48Sopenharmony_ci          v.getBoundingClientRect().top -
687fb726d48Sopenharmony_ci          this.timerShaftEL?.clientHeight! -
688fb726d48Sopenharmony_ci          this.parentElement!.previousElementSibling!.clientHeight -
689fb726d48Sopenharmony_ci          1;
690fb726d48Sopenharmony_ci      } else {
691fb726d48Sopenharmony_ci        v.translateY = v.offsetTop - this.rowsPaneEL!.scrollTop;
692fb726d48Sopenharmony_ci      }
693fb726d48Sopenharmony_ci      v.draw(cache);
694fb726d48Sopenharmony_ci    });
695fb726d48Sopenharmony_ci    this.drawAllLines();
696fb726d48Sopenharmony_ci  }
697fb726d48Sopenharmony_ci
698fb726d48Sopenharmony_ci  drawWakeUpLine(): void {
699fb726d48Sopenharmony_ci    //draw wakeup for main canvas
700fb726d48Sopenharmony_ci    drawWakeUp(
701fb726d48Sopenharmony_ci      this.canvasPanelCtx,
702fb726d48Sopenharmony_ci      CpuStruct.wakeupBean,
703fb726d48Sopenharmony_ci      TraceRow.range!.startNS,
704fb726d48Sopenharmony_ci      TraceRow.range!.endNS,
705fb726d48Sopenharmony_ci      TraceRow.range!.totalNS,
706fb726d48Sopenharmony_ci      {
707fb726d48Sopenharmony_ci        x: 0,
708fb726d48Sopenharmony_ci        y: 0,
709fb726d48Sopenharmony_ci        width: TraceRow.FRAME_WIDTH,
710fb726d48Sopenharmony_ci        height: this.canvasPanel!.clientHeight!,
711fb726d48Sopenharmony_ci      } as Rect
712fb726d48Sopenharmony_ci    );
713fb726d48Sopenharmony_ci    this.favoriteChartListEL?.drawWakeUp();
714fb726d48Sopenharmony_ci    // draw wakeuplist for main canvas
715fb726d48Sopenharmony_ci    for (let i = 0; i < SpSystemTrace.wakeupList.length; i++) {
716fb726d48Sopenharmony_ci      if (i + 1 === SpSystemTrace.wakeupList.length) {
717fb726d48Sopenharmony_ci        return;
718fb726d48Sopenharmony_ci      }
719fb726d48Sopenharmony_ci      drawWakeUpList(
720fb726d48Sopenharmony_ci        this.canvasPanelCtx,
721fb726d48Sopenharmony_ci        SpSystemTrace.wakeupList[i + 1],
722fb726d48Sopenharmony_ci        TraceRow.range!.startNS,
723fb726d48Sopenharmony_ci        TraceRow.range!.endNS,
724fb726d48Sopenharmony_ci        TraceRow.range!.totalNS,
725fb726d48Sopenharmony_ci        {
726fb726d48Sopenharmony_ci          x: 0,
727fb726d48Sopenharmony_ci          y: 0,
728fb726d48Sopenharmony_ci          width: this.timerShaftEL!.canvas!.clientWidth,
729fb726d48Sopenharmony_ci          height: this.canvasPanel!.clientHeight!,
730fb726d48Sopenharmony_ci        } as Rect
731fb726d48Sopenharmony_ci      );
732fb726d48Sopenharmony_ci      this.favoriteChartListEL?.drawWakeUpList(SpSystemTrace.wakeupList[i + 1]);
733fb726d48Sopenharmony_ci    }
734fb726d48Sopenharmony_ci  }
735fb726d48Sopenharmony_ci
736fb726d48Sopenharmony_ci  drawAllLines(): void {
737fb726d48Sopenharmony_ci    // draw flag line segment for canvas
738fb726d48Sopenharmony_ci    drawFlagLineSegment(
739fb726d48Sopenharmony_ci      this.canvasPanelCtx,
740fb726d48Sopenharmony_ci      this.hoverFlag,
741fb726d48Sopenharmony_ci      this.selectFlag,
742fb726d48Sopenharmony_ci      {
743fb726d48Sopenharmony_ci        x: 0,
744fb726d48Sopenharmony_ci        y: 0,
745fb726d48Sopenharmony_ci        width: this.timerShaftEL?.canvas?.clientWidth,
746fb726d48Sopenharmony_ci        height: this.canvasPanel?.clientHeight,
747fb726d48Sopenharmony_ci      } as Rect,
748fb726d48Sopenharmony_ci      this.timerShaftEL!
749fb726d48Sopenharmony_ci    );
750fb726d48Sopenharmony_ci    this.favoriteChartListEL?.drawFlagLineSegment(this.hoverFlag, this.selectFlag, this.timerShaftEL!);
751fb726d48Sopenharmony_ci    this.drawWakeUpLine();
752fb726d48Sopenharmony_ci    //draw system logs line segment for canvas
753fb726d48Sopenharmony_ci    drawLogsLineSegment(
754fb726d48Sopenharmony_ci      this.canvasPanelCtx,
755fb726d48Sopenharmony_ci      this.traceSheetEL?.systemLogFlag,
756fb726d48Sopenharmony_ci      {
757fb726d48Sopenharmony_ci        x: 0,
758fb726d48Sopenharmony_ci        y: 0,
759fb726d48Sopenharmony_ci        width: this.timerShaftEL?.canvas?.clientWidth,
760fb726d48Sopenharmony_ci        height: this.canvasPanel?.clientHeight,
761fb726d48Sopenharmony_ci      },
762fb726d48Sopenharmony_ci      this.timerShaftEL!
763fb726d48Sopenharmony_ci    );
764fb726d48Sopenharmony_ci    this.favoriteChartListEL?.drawLogsLineSegment(this.traceSheetEL!.systemLogFlag, this.timerShaftEL!);
765fb726d48Sopenharmony_ci
766fb726d48Sopenharmony_ci    // Draw the connection curve
767fb726d48Sopenharmony_ci    if (this.linkNodes && this.linkNodes.length > 0) {
768fb726d48Sopenharmony_ci      drawLinkLines(
769fb726d48Sopenharmony_ci        this.canvasPanelCtx!,
770fb726d48Sopenharmony_ci        this.linkNodes,
771fb726d48Sopenharmony_ci        this.timerShaftEL!,
772fb726d48Sopenharmony_ci        false,
773fb726d48Sopenharmony_ci        this.favoriteChartListEL!.clientHeight
774fb726d48Sopenharmony_ci      );
775fb726d48Sopenharmony_ci      this.favoriteChartListEL?.drawLinkLines(
776fb726d48Sopenharmony_ci        this.linkNodes,
777fb726d48Sopenharmony_ci        this.timerShaftEL!,
778fb726d48Sopenharmony_ci        true,
779fb726d48Sopenharmony_ci        this.favoriteChartListEL!.clientHeight
780fb726d48Sopenharmony_ci      );
781fb726d48Sopenharmony_ci    }
782fb726d48Sopenharmony_ci    // draw prio curve
783fb726d48Sopenharmony_ci    if (
784fb726d48Sopenharmony_ci      ThreadStruct.isClickPrio &&
785fb726d48Sopenharmony_ci      this.currentRow!.parentRowEl!.expansion &&
786fb726d48Sopenharmony_ci      ThreadStruct.selectThreadStruct &&
787fb726d48Sopenharmony_ci      ThreadStruct.contrast(ThreadStruct.selectThreadStruct, this.currentRow!.rowParentId, this.currentRow!.rowId)
788fb726d48Sopenharmony_ci    ) {
789fb726d48Sopenharmony_ci      let context: CanvasRenderingContext2D;
790fb726d48Sopenharmony_ci      if (this.currentRow!.currentContext) {
791fb726d48Sopenharmony_ci        context = this.currentRow!.currentContext;
792fb726d48Sopenharmony_ci      } else {
793fb726d48Sopenharmony_ci        context = this.currentRow!.collect ? this.canvasFavoritePanelCtx! : this.canvasPanelCtx!;
794fb726d48Sopenharmony_ci      }
795fb726d48Sopenharmony_ci      this.drawPrioCurve(context, this.currentRow!);
796fb726d48Sopenharmony_ci    }
797fb726d48Sopenharmony_ci  }
798fb726d48Sopenharmony_ci
799fb726d48Sopenharmony_ci  // draw prio curve
800fb726d48Sopenharmony_ci  // @ts-ignore
801fb726d48Sopenharmony_ci  drawPrioCurve(context: unknown, row: TraceRow<unknown>): void {
802fb726d48Sopenharmony_ci    let curveDrawList: unknown = [];
803fb726d48Sopenharmony_ci    let oldVal: number = -1;
804fb726d48Sopenharmony_ci    // @ts-ignore
805fb726d48Sopenharmony_ci    let threadFilter = row.dataListCache.filter((it: unknown) => it.state === 'Running'); //筛选状态是Running的数据
806fb726d48Sopenharmony_ci    //计算每个点的坐标
807fb726d48Sopenharmony_ci    // @ts-ignore
808fb726d48Sopenharmony_ci    prioClickHandlerFun(ThreadStruct.prioCount, row, threadFilter, curveDrawList, oldVal);
809fb726d48Sopenharmony_ci    //绘制曲线透明度设置1,根据计算的曲线坐标开始画图
810fb726d48Sopenharmony_ci    // @ts-ignore
811fb726d48Sopenharmony_ci    context.globalAlpha = 1;
812fb726d48Sopenharmony_ci    // @ts-ignore
813fb726d48Sopenharmony_ci    context.beginPath();
814fb726d48Sopenharmony_ci    let x0;
815fb726d48Sopenharmony_ci    let y0;
816fb726d48Sopenharmony_ci    // @ts-ignore
817fb726d48Sopenharmony_ci    if (curveDrawList[0] && curveDrawList[0].frame) {
818fb726d48Sopenharmony_ci      // @ts-ignore
819fb726d48Sopenharmony_ci      x0 = curveDrawList[0].frame.x;
820fb726d48Sopenharmony_ci      // @ts-ignore
821fb726d48Sopenharmony_ci      y0 = curveDrawList[0].curveFloatY;
822fb726d48Sopenharmony_ci    }
823fb726d48Sopenharmony_ci    // @ts-ignore
824fb726d48Sopenharmony_ci    context!.moveTo(x0!, y0!);
825fb726d48Sopenharmony_ci    // @ts-ignore
826fb726d48Sopenharmony_ci    if (SpSystemTrace.isKeyUp || curveDrawList.length < 90) {
827fb726d48Sopenharmony_ci      // @ts-ignore
828fb726d48Sopenharmony_ci      for (let i = 0; i < curveDrawList.length - 1; i++) {
829fb726d48Sopenharmony_ci        // @ts-ignore
830fb726d48Sopenharmony_ci        let re = curveDrawList[i];
831fb726d48Sopenharmony_ci        // @ts-ignore
832fb726d48Sopenharmony_ci        let nextRe = curveDrawList[i + 1];
833fb726d48Sopenharmony_ci        // @ts-ignore
834fb726d48Sopenharmony_ci        drawThreadCurve(context, re, nextRe);
835fb726d48Sopenharmony_ci      }
836fb726d48Sopenharmony_ci      // @ts-ignore
837fb726d48Sopenharmony_ci      context.closePath();
838fb726d48Sopenharmony_ci      // @ts-ignore
839fb726d48Sopenharmony_ci    } else if (!SpSystemTrace.isKeyUp && curveDrawList.length >= 90) {
840fb726d48Sopenharmony_ci      let x;
841fb726d48Sopenharmony_ci      let y;
842fb726d48Sopenharmony_ci      // @ts-ignore
843fb726d48Sopenharmony_ci      if (curveDrawList[curveDrawList.length - 1] && curveDrawList[curveDrawList.length - 1].frame) {
844fb726d48Sopenharmony_ci        // @ts-ignore
845fb726d48Sopenharmony_ci        x = curveDrawList[curveDrawList.length - 1].frame.x;
846fb726d48Sopenharmony_ci        // @ts-ignore
847fb726d48Sopenharmony_ci        y = curveDrawList[curveDrawList.length - 1].curveFloatY;
848fb726d48Sopenharmony_ci      }
849fb726d48Sopenharmony_ci      // @ts-ignore
850fb726d48Sopenharmony_ci      context.lineWidth = 1;
851fb726d48Sopenharmony_ci      // @ts-ignore
852fb726d48Sopenharmony_ci      context.strokeStyle = '#ffc90e';
853fb726d48Sopenharmony_ci      // @ts-ignore
854fb726d48Sopenharmony_ci      context.lineCap = 'round';
855fb726d48Sopenharmony_ci      // @ts-ignore
856fb726d48Sopenharmony_ci      context.lineTo(x, y);
857fb726d48Sopenharmony_ci      // @ts-ignore
858fb726d48Sopenharmony_ci      context.stroke();
859fb726d48Sopenharmony_ci    }
860fb726d48Sopenharmony_ci  }
861fb726d48Sopenharmony_ci
862fb726d48Sopenharmony_ci  documentOnMouseDown = (ev: MouseEvent): void => spSystemTraceDocumentOnMouseDown(this, ev);
863fb726d48Sopenharmony_ci
864fb726d48Sopenharmony_ci  onContextMenuHandler = (e: Event): void => {
865fb726d48Sopenharmony_ci    setTimeout(() => {
866fb726d48Sopenharmony_ci      for (let key of this.keyPressMap.keys()) {
867fb726d48Sopenharmony_ci        if (this.keyPressMap.get(key)) {
868fb726d48Sopenharmony_ci          this.timerShaftEL?.stopWASD({ key: key });
869fb726d48Sopenharmony_ci          this.keyPressMap.set(key, false);
870fb726d48Sopenharmony_ci        }
871fb726d48Sopenharmony_ci      }
872fb726d48Sopenharmony_ci    }, 100);
873fb726d48Sopenharmony_ci  };
874fb726d48Sopenharmony_ci
875fb726d48Sopenharmony_ci  documentOnMouseUp = (ev: MouseEvent): void => spSystemTraceDocumentOnMouseUp(this, ev);
876fb726d48Sopenharmony_ci
877fb726d48Sopenharmony_ci  cancelDrag(): void {
878fb726d48Sopenharmony_ci    this.rangeSelect.drag = false;
879fb726d48Sopenharmony_ci    this.rangeSelect.isMouseDown = false;
880fb726d48Sopenharmony_ci    TraceRow.rangeSelectObject = {
881fb726d48Sopenharmony_ci      startX: 0,
882fb726d48Sopenharmony_ci      endX: 0,
883fb726d48Sopenharmony_ci      startNS: 0,
884fb726d48Sopenharmony_ci      endNS: 0,
885fb726d48Sopenharmony_ci    };
886fb726d48Sopenharmony_ci  }
887fb726d48Sopenharmony_ci
888fb726d48Sopenharmony_ci  documentOnMouseOut = (ev: MouseEvent): void => spSystemTraceDocumentOnMouseOut(this, ev);
889fb726d48Sopenharmony_ci
890fb726d48Sopenharmony_ci  keyPressMap: Map<string, boolean> = new Map([
891fb726d48Sopenharmony_ci    ['w', false],
892fb726d48Sopenharmony_ci    ['s', false],
893fb726d48Sopenharmony_ci    ['a', false],
894fb726d48Sopenharmony_ci    ['d', false],
895fb726d48Sopenharmony_ci    ['f', false],
896fb726d48Sopenharmony_ci  ]);
897fb726d48Sopenharmony_ci
898fb726d48Sopenharmony_ci  documentOnKeyDown = (ev: KeyboardEvent): void => spSystemTraceDocumentOnKeyDown(this, ev);
899fb726d48Sopenharmony_ci
900fb726d48Sopenharmony_ci  documentOnKeyPress = (ev: KeyboardEvent): void => spSystemTraceDocumentOnKeyPress(this, ev);
901fb726d48Sopenharmony_ci
902fb726d48Sopenharmony_ci  verticalScrollToRow(): void {
903fb726d48Sopenharmony_ci    if (this.currentRow) {
904fb726d48Sopenharmony_ci      //@ts-ignore
905fb726d48Sopenharmony_ci      this.currentRow.scrollIntoViewIfNeeded();
906fb726d48Sopenharmony_ci    }
907fb726d48Sopenharmony_ci  }
908fb726d48Sopenharmony_ci
909fb726d48Sopenharmony_ci  setCurrentSlicesTime(): void {
910fb726d48Sopenharmony_ci    if (CpuStruct.selectCpuStruct) {
911fb726d48Sopenharmony_ci      this.currentSlicesTime.startTime = CpuStruct.selectCpuStruct.startTime;
912fb726d48Sopenharmony_ci      this.currentSlicesTime.endTime = CpuStruct.selectCpuStruct.startTime! + CpuStruct.selectCpuStruct.dur!;
913fb726d48Sopenharmony_ci    } else if (ThreadStruct.selectThreadStruct) {
914fb726d48Sopenharmony_ci      this.currentSlicesTime.startTime = ThreadStruct.selectThreadStruct.startTime;
915fb726d48Sopenharmony_ci      this.currentSlicesTime.endTime =
916fb726d48Sopenharmony_ci        ThreadStruct.selectThreadStruct.startTime! + ThreadStruct.selectThreadStruct.dur!;
917fb726d48Sopenharmony_ci    } else if (FuncStruct.selectFuncStruct) {
918fb726d48Sopenharmony_ci      this.currentSlicesTime.startTime = FuncStruct.selectFuncStruct.startTs;
919fb726d48Sopenharmony_ci      this.currentSlicesTime.endTime = FuncStruct.selectFuncStruct.startTs! + FuncStruct.selectFuncStruct.dur!;
920fb726d48Sopenharmony_ci    } else if (IrqStruct.selectIrqStruct) {
921fb726d48Sopenharmony_ci      this.currentSlicesTime.startTime = IrqStruct.selectIrqStruct.startNS;
922fb726d48Sopenharmony_ci      this.currentSlicesTime.endTime = IrqStruct.selectIrqStruct.startNS! + IrqStruct.selectIrqStruct.dur!;
923fb726d48Sopenharmony_ci    } else if (TraceRow.rangeSelectObject) {
924fb726d48Sopenharmony_ci      this.currentRow = undefined;
925fb726d48Sopenharmony_ci      if (TraceRow.rangeSelectObject.startNS && TraceRow.rangeSelectObject.endNS) {
926fb726d48Sopenharmony_ci        this.currentSlicesTime.startTime = TraceRow.rangeSelectObject.startNS;
927fb726d48Sopenharmony_ci        this.currentSlicesTime.endTime = TraceRow.rangeSelectObject.endNS;
928fb726d48Sopenharmony_ci      }
929fb726d48Sopenharmony_ci    } else if (JankStruct.selectJankStruct) {
930fb726d48Sopenharmony_ci      this.currentSlicesTime.startTime = JankStruct.selectJankStruct.ts;
931fb726d48Sopenharmony_ci      this.currentSlicesTime.endTime = JankStruct.selectJankStruct.ts! + JankStruct.selectJankStruct.dur!;
932fb726d48Sopenharmony_ci    } else if (SampleStruct.selectSampleStruct) {
933fb726d48Sopenharmony_ci      if (SampleStruct.selectSampleStruct.begin && SampleStruct.selectSampleStruct.end) {
934fb726d48Sopenharmony_ci        this.currentSlicesTime.startTime =
935fb726d48Sopenharmony_ci          SampleStruct.selectSampleStruct.begin - SampleStruct.selectSampleStruct.startTs!;
936fb726d48Sopenharmony_ci        this.currentSlicesTime.endTime = SampleStruct.selectSampleStruct.end - SampleStruct.selectSampleStruct.startTs!;
937fb726d48Sopenharmony_ci      }
938fb726d48Sopenharmony_ci    } else if (GpuCounterStruct.selectGpuCounterStruct) {
939fb726d48Sopenharmony_ci      this.currentSlicesTime.startTime =
940fb726d48Sopenharmony_ci        GpuCounterStruct.selectGpuCounterStruct.startNS! - GpuCounterStruct.selectGpuCounterStruct.startTime!;
941fb726d48Sopenharmony_ci      this.currentSlicesTime.endTime =
942fb726d48Sopenharmony_ci        GpuCounterStruct.selectGpuCounterStruct.startNS! +
943fb726d48Sopenharmony_ci        GpuCounterStruct.selectGpuCounterStruct.dur! -
944fb726d48Sopenharmony_ci        GpuCounterStruct.selectGpuCounterStruct.startTime!;
945fb726d48Sopenharmony_ci    } else if (AppStartupStruct.selectStartupStruct) {
946fb726d48Sopenharmony_ci      this.currentSlicesTime.startTime = AppStartupStruct.selectStartupStruct.startTs;
947fb726d48Sopenharmony_ci      this.currentSlicesTime.endTime = AppStartupStruct.selectStartupStruct.startTs! + AppStartupStruct.selectStartupStruct.dur!;
948fb726d48Sopenharmony_ci    } else if (AllAppStartupStruct.selectStartupStruct) {
949fb726d48Sopenharmony_ci      this.currentSlicesTime.startTime = AllAppStartupStruct.selectStartupStruct.startTs;
950fb726d48Sopenharmony_ci      this.currentSlicesTime.endTime = AllAppStartupStruct.selectStartupStruct.startTs! + AllAppStartupStruct.selectStartupStruct.dur!;
951fb726d48Sopenharmony_ci    } else if (PerfToolStruct.selectPerfToolStruct) {
952fb726d48Sopenharmony_ci      this.currentSlicesTime.startTime = PerfToolStruct.selectPerfToolStruct.startTs;
953fb726d48Sopenharmony_ci      this.currentSlicesTime.endTime = PerfToolStruct.selectPerfToolStruct.startTs! + PerfToolStruct.selectPerfToolStruct.dur!;
954fb726d48Sopenharmony_ci    } else if (DmaFenceStruct.selectDmaFenceStruct) {
955fb726d48Sopenharmony_ci      if (DmaFenceStruct.selectDmaFenceStruct.startTime && DmaFenceStruct.selectDmaFenceStruct.dur) {
956fb726d48Sopenharmony_ci        this.currentSlicesTime.startTime = DmaFenceStruct.selectDmaFenceStruct.startTime;
957fb726d48Sopenharmony_ci        this.currentSlicesTime.endTime = DmaFenceStruct.selectDmaFenceStruct.startTime + DmaFenceStruct.selectDmaFenceStruct.dur;
958fb726d48Sopenharmony_ci      }
959fb726d48Sopenharmony_ci    } else {
960fb726d48Sopenharmony_ci      this.currentSlicesTime.startTime = 0;
961fb726d48Sopenharmony_ci      this.currentSlicesTime.endTime = 0;
962fb726d48Sopenharmony_ci    }
963fb726d48Sopenharmony_ci  }
964fb726d48Sopenharmony_ci
965fb726d48Sopenharmony_ci  public setSLiceMark = (shiftKey: boolean): SlicesTime | null | undefined => {
966fb726d48Sopenharmony_ci    const selectedStruct: unknown =
967fb726d48Sopenharmony_ci      CpuStruct.selectCpuStruct ||
968fb726d48Sopenharmony_ci      ThreadStruct.selectThreadStruct ||
969fb726d48Sopenharmony_ci      TraceRow.rangeSelectObject ||
970fb726d48Sopenharmony_ci      FuncStruct.selectFuncStruct ||
971fb726d48Sopenharmony_ci      IrqStruct.selectIrqStruct ||
972fb726d48Sopenharmony_ci      JankStruct.selectJankStruct ||
973fb726d48Sopenharmony_ci      AppStartupStruct.selectStartupStruct ||
974fb726d48Sopenharmony_ci      SoStruct.selectSoStruct ||
975fb726d48Sopenharmony_ci      SampleStruct.selectSampleStruct ||
976fb726d48Sopenharmony_ci      GpuCounterStruct.selectGpuCounterStruct ||
977fb726d48Sopenharmony_ci      AllAppStartupStruct.selectStartupStruct ||
978fb726d48Sopenharmony_ci      FrameAnimationStruct.selectFrameAnimationStruct ||
979fb726d48Sopenharmony_ci      JsCpuProfilerStruct.selectJsCpuProfilerStruct ||
980fb726d48Sopenharmony_ci      PerfToolStruct.selectPerfToolStruct ||
981fb726d48Sopenharmony_ci      DmaFenceStruct.selectDmaFenceStruct;
982fb726d48Sopenharmony_ci    this.calculateSlicesTime(selectedStruct, shiftKey);
983fb726d48Sopenharmony_ci
984fb726d48Sopenharmony_ci    return this.slicestime;
985fb726d48Sopenharmony_ci  };
986fb726d48Sopenharmony_ci
987fb726d48Sopenharmony_ci  private calculateSlicesTime(selected: unknown, shiftKey: boolean): void {
988fb726d48Sopenharmony_ci    if (selected) {
989fb726d48Sopenharmony_ci      let startTs = 0;
990fb726d48Sopenharmony_ci      // @ts-ignore
991fb726d48Sopenharmony_ci      if (selected.begin && selected.end) {
992fb726d48Sopenharmony_ci        // @ts-ignore
993fb726d48Sopenharmony_ci        startTs = selected.begin - selected.startTs;
994fb726d48Sopenharmony_ci        // @ts-ignore
995fb726d48Sopenharmony_ci        let end = selected.end - selected.startTs;
996fb726d48Sopenharmony_ci        this.slicestime = this.timerShaftEL?.setSlicesMark(startTs, end, shiftKey);
997fb726d48Sopenharmony_ci        // @ts-ignore
998fb726d48Sopenharmony_ci      } else if (selected.startNS && selected.dur) {
999fb726d48Sopenharmony_ci        // @ts-ignore
1000fb726d48Sopenharmony_ci        startTs = selected.startNS - selected.startTime;
1001fb726d48Sopenharmony_ci        // @ts-ignore
1002fb726d48Sopenharmony_ci        let end = selected.startNS + selected.dur - selected.startTime;
1003fb726d48Sopenharmony_ci        this.slicestime = this.timerShaftEL?.setSlicesMark(startTs, end, shiftKey);
1004fb726d48Sopenharmony_ci      } else {
1005fb726d48Sopenharmony_ci        // @ts-ignore
1006fb726d48Sopenharmony_ci        startTs = selected.startTs || selected.startTime || selected.startNS || selected.ts || 0;
1007fb726d48Sopenharmony_ci        // @ts-ignore
1008fb726d48Sopenharmony_ci        let dur = selected.dur || selected.totalTime || selected.endNS - selected.startNS || 0;
1009fb726d48Sopenharmony_ci        this.slicestime = this.timerShaftEL?.setSlicesMark(startTs, startTs + dur, shiftKey);
1010fb726d48Sopenharmony_ci      }
1011fb726d48Sopenharmony_ci    } else {
1012fb726d48Sopenharmony_ci      this.slicestime = this.timerShaftEL?.setSlicesMark();
1013fb726d48Sopenharmony_ci    }
1014fb726d48Sopenharmony_ci  }
1015fb726d48Sopenharmony_ci
1016fb726d48Sopenharmony_ci  stopWASD = (): void => {
1017fb726d48Sopenharmony_ci    setTimeout((): void => {
1018fb726d48Sopenharmony_ci      for (let key of this.keyPressMap.keys()) {
1019fb726d48Sopenharmony_ci        if (this.keyPressMap.get(key)) {
1020fb726d48Sopenharmony_ci          this.timerShaftEL?.stopWASD({ key: key });
1021fb726d48Sopenharmony_ci          this.keyPressMap.set(key, false);
1022fb726d48Sopenharmony_ci        }
1023fb726d48Sopenharmony_ci      }
1024fb726d48Sopenharmony_ci    }, 100);
1025fb726d48Sopenharmony_ci  };
1026fb726d48Sopenharmony_ci
1027fb726d48Sopenharmony_ci  // 一直按着回车键的时候执行搜索功能
1028fb726d48Sopenharmony_ci  continueSearch = (ev: KeyboardEvent): void => {
1029fb726d48Sopenharmony_ci    if (ev.key === 'Enter') {
1030fb726d48Sopenharmony_ci      if (ev.shiftKey) {
1031fb726d48Sopenharmony_ci        this.dispatchEvent(
1032fb726d48Sopenharmony_ci          new CustomEvent('trace-previous-data', {
1033fb726d48Sopenharmony_ci            detail: { down: true },
1034fb726d48Sopenharmony_ci            composed: false,
1035fb726d48Sopenharmony_ci          })
1036fb726d48Sopenharmony_ci        );
1037fb726d48Sopenharmony_ci      } else {
1038fb726d48Sopenharmony_ci        this.dispatchEvent(
1039fb726d48Sopenharmony_ci          new CustomEvent('trace-next-data', {
1040fb726d48Sopenharmony_ci            detail: { down: true },
1041fb726d48Sopenharmony_ci            composed: false,
1042fb726d48Sopenharmony_ci          })
1043fb726d48Sopenharmony_ci        );
1044fb726d48Sopenharmony_ci      }
1045fb726d48Sopenharmony_ci    }
1046fb726d48Sopenharmony_ci  };
1047fb726d48Sopenharmony_ci
1048fb726d48Sopenharmony_ci  documentOnKeyUp = (ev: KeyboardEvent): void => spSystemTraceDocumentOnKeyUp(this, ev);
1049fb726d48Sopenharmony_ci
1050fb726d48Sopenharmony_ci  /**
1051fb726d48Sopenharmony_ci   * 根据传入的参数实现卡尺和旗子的快捷跳转
1052fb726d48Sopenharmony_ci   * @param list 要跳转的数组
1053fb726d48Sopenharmony_ci   * @param type 标记类型(卡尺和旗子)
1054fb726d48Sopenharmony_ci   * @param direction 跳转方向(前一个/后一个)
1055fb726d48Sopenharmony_ci   */
1056fb726d48Sopenharmony_ci  MarkJump(list: Array<unknown>, type: string, direction: string, ev: KeyboardEvent): void {
1057fb726d48Sopenharmony_ci    this.traceSheetEL = this.shadowRoot?.querySelector('.trace-sheet'); // @ts-ignore
1058fb726d48Sopenharmony_ci    let find = list.find((it) => it.selected);
1059fb726d48Sopenharmony_ci    if (!find) {
1060fb726d48Sopenharmony_ci      // 如果当前没有选中的,就选中第一个
1061fb726d48Sopenharmony_ci      // @ts-ignore
1062fb726d48Sopenharmony_ci      list.forEach((it) => (it.selected = false));
1063fb726d48Sopenharmony_ci      this.ifSliceInView(list[0], type, ev); // @ts-ignore
1064fb726d48Sopenharmony_ci      list[0].selected = true;
1065fb726d48Sopenharmony_ci    } else {
1066fb726d48Sopenharmony_ci      for (let i = 0; i < list.length; i++) {
1067fb726d48Sopenharmony_ci        // 将当前数组中选中的那条数据改为未选中
1068fb726d48Sopenharmony_ci        // @ts-ignore
1069fb726d48Sopenharmony_ci        if (list[i].selected) {
1070fb726d48Sopenharmony_ci          // @ts-ignore
1071fb726d48Sopenharmony_ci          list[i].selected = false;
1072fb726d48Sopenharmony_ci          if (direction === 'previous') {
1073fb726d48Sopenharmony_ci            if (i === 0) {
1074fb726d48Sopenharmony_ci              // 如果当前选中的是第一个,就循环到最后一个上
1075fb726d48Sopenharmony_ci              this.ifSliceInView(list[list.length - 1], type, ev); // @ts-ignore
1076fb726d48Sopenharmony_ci              list[list.length - 1].selected = true;
1077fb726d48Sopenharmony_ci              break;
1078fb726d48Sopenharmony_ci            } else {
1079fb726d48Sopenharmony_ci              // 选中当前的上一个
1080fb726d48Sopenharmony_ci              this.ifSliceInView(list[i - 1], type, ev); // @ts-ignore
1081fb726d48Sopenharmony_ci              list[i - 1].selected = true;
1082fb726d48Sopenharmony_ci              break;
1083fb726d48Sopenharmony_ci            }
1084fb726d48Sopenharmony_ci          } else if (direction === 'next') {
1085fb726d48Sopenharmony_ci            if (i === list.length - 1) {
1086fb726d48Sopenharmony_ci              // 如果当前选中的是最后一个,就循环到第一个上
1087fb726d48Sopenharmony_ci              this.ifSliceInView(list[0], type, ev); // @ts-ignore
1088fb726d48Sopenharmony_ci              list[0].selected = true;
1089fb726d48Sopenharmony_ci              break;
1090fb726d48Sopenharmony_ci            } else {
1091fb726d48Sopenharmony_ci              // 选中当前的下一个
1092fb726d48Sopenharmony_ci              this.ifSliceInView(list[i + 1], type, ev); // @ts-ignore
1093fb726d48Sopenharmony_ci              list[i + 1].selected = true;
1094fb726d48Sopenharmony_ci              break;
1095fb726d48Sopenharmony_ci            }
1096fb726d48Sopenharmony_ci          }
1097fb726d48Sopenharmony_ci        }
1098fb726d48Sopenharmony_ci      }
1099fb726d48Sopenharmony_ci    }
1100fb726d48Sopenharmony_ci
1101fb726d48Sopenharmony_ci    if (type === 'flag') {
1102fb726d48Sopenharmony_ci      let currentPane = this.traceSheetEL?.displayTab<TabPaneFlag>('box-flag');
1103fb726d48Sopenharmony_ci      list.forEach((flag, index) => {
1104fb726d48Sopenharmony_ci        // @ts-ignore
1105fb726d48Sopenharmony_ci        this.timerShaftEL!.sportRuler!.drawTriangle(flag.time, flag.type); // @ts-ignore
1106fb726d48Sopenharmony_ci        if (flag.selected) {
1107fb726d48Sopenharmony_ci          // 修改当前选中的旗子对应的表格中某行的背景
1108fb726d48Sopenharmony_ci          currentPane!.setTableSelection(index + 1);
1109fb726d48Sopenharmony_ci        }
1110fb726d48Sopenharmony_ci      });
1111fb726d48Sopenharmony_ci    } else if (type === 'slice') {
1112fb726d48Sopenharmony_ci      this.refreshCanvas(true);
1113fb726d48Sopenharmony_ci      let currentPane = this.traceSheetEL?.displayTab<TabPaneCurrent>('tabpane-current');
1114fb726d48Sopenharmony_ci      list.forEach((slice, index) => {
1115fb726d48Sopenharmony_ci        // @ts-ignore
1116fb726d48Sopenharmony_ci        if (slice.selected) {
1117fb726d48Sopenharmony_ci          // 修改当前选中的卡尺对应的表格中某行的背景
1118fb726d48Sopenharmony_ci          currentPane!.setTableSelection(index + 1);
1119fb726d48Sopenharmony_ci        }
1120fb726d48Sopenharmony_ci      });
1121fb726d48Sopenharmony_ci    }
1122fb726d48Sopenharmony_ci  }
1123fb726d48Sopenharmony_ci
1124fb726d48Sopenharmony_ci  ifSliceInView(data: unknown, type: string, ev: KeyboardEvent): void {
1125fb726d48Sopenharmony_ci    let timeRangeEndNS = this.timerShaftEL?.getRangeRuler()?.range.endNS;
1126fb726d48Sopenharmony_ci    let timeRangeStartNS = this.timerShaftEL?.getRangeRuler()?.range.startNS;
1127fb726d48Sopenharmony_ci    if (type === 'flag') {
1128fb726d48Sopenharmony_ci      // @ts-ignore
1129fb726d48Sopenharmony_ci      data.startTime = data.time; // @ts-ignore
1130fb726d48Sopenharmony_ci      data.endTime = data.time;
1131fb726d48Sopenharmony_ci    } // @ts-ignore
1132fb726d48Sopenharmony_ci    let endTime = data.endTime; // @ts-ignore
1133fb726d48Sopenharmony_ci    let startTime = data.startTime;
1134fb726d48Sopenharmony_ci    if (endTime > timeRangeEndNS! || startTime < timeRangeStartNS!) {
1135fb726d48Sopenharmony_ci      // @ts-ignore
1136fb726d48Sopenharmony_ci      this.timerShaftEL!.documentOnKeyPress(ev, data);
1137fb726d48Sopenharmony_ci      setTimeout(() => {
1138fb726d48Sopenharmony_ci        this.timerShaftEL!.documentOnKeyUp(ev);
1139fb726d48Sopenharmony_ci      }, 1000);
1140fb726d48Sopenharmony_ci    }
1141fb726d48Sopenharmony_ci  }
1142fb726d48Sopenharmony_ci
1143fb726d48Sopenharmony_ci  isMouseInSheet = (ev: MouseEvent): boolean => {
1144fb726d48Sopenharmony_ci    this.isMousePointInSheet =
1145fb726d48Sopenharmony_ci      this.traceSheetEL?.getAttribute('mode') !== 'hidden' &&
1146fb726d48Sopenharmony_ci      ev.offsetX > this.traceSheetEL!.offsetLeft &&
1147fb726d48Sopenharmony_ci      ev.offsetY > this.traceSheetEL!.offsetTop;
1148fb726d48Sopenharmony_ci    return this.isMousePointInSheet;
1149fb726d48Sopenharmony_ci  };
1150fb726d48Sopenharmony_ci  // @ts-ignore
1151fb726d48Sopenharmony_ci  favoriteChangeHandler = (row: TraceRow<unknown>): void => {
1152fb726d48Sopenharmony_ci    info('favoriteChangeHandler', row.frame, row.offsetTop, row.offsetHeight);
1153fb726d48Sopenharmony_ci  };
1154fb726d48Sopenharmony_ci
1155fb726d48Sopenharmony_ci  /**
1156fb726d48Sopenharmony_ci   * 根据选择的traceRow 处理foler
1157fb726d48Sopenharmony_ci   * @param currentRow 当前点击checkbox的row
1158fb726d48Sopenharmony_ci   */
1159fb726d48Sopenharmony_ci  // @ts-ignore
1160fb726d48Sopenharmony_ci  setParentCheckStatus(currentRow: TraceRow<unknown>): void {
1161fb726d48Sopenharmony_ci    if (currentRow.parentRowEl?.folder && currentRow.parentRowEl?.childrenList) {
1162fb726d48Sopenharmony_ci      const parent = currentRow.parentRowEl;
1163fb726d48Sopenharmony_ci      const childrenList = parent.childrenList;
1164fb726d48Sopenharmony_ci      const selectList = [];
1165fb726d48Sopenharmony_ci      const unSelectList = [];
1166fb726d48Sopenharmony_ci      for (const child of childrenList) {
1167fb726d48Sopenharmony_ci        if (child.checkType === '2') {
1168fb726d48Sopenharmony_ci          selectList.push(child);
1169fb726d48Sopenharmony_ci        } else {
1170fb726d48Sopenharmony_ci          unSelectList.push(child);
1171fb726d48Sopenharmony_ci        }
1172fb726d48Sopenharmony_ci      }
1173fb726d48Sopenharmony_ci      if (unSelectList.length === 0) {
1174fb726d48Sopenharmony_ci        parent.setAttribute('check-type', '2');
1175fb726d48Sopenharmony_ci        parent.rangeSelect = true;
1176fb726d48Sopenharmony_ci        parent.checkBoxEL!.checked = true;
1177fb726d48Sopenharmony_ci        parent.checkBoxEL!.indeterminate = false;
1178fb726d48Sopenharmony_ci      } else if (selectList.length === 0) {
1179fb726d48Sopenharmony_ci        parent.setAttribute('check-type', '0');
1180fb726d48Sopenharmony_ci        parent.rangeSelect = false;
1181fb726d48Sopenharmony_ci        parent.checkBoxEL!.checked = false;
1182fb726d48Sopenharmony_ci        parent.checkBoxEL!.indeterminate = false;
1183fb726d48Sopenharmony_ci      } else {
1184fb726d48Sopenharmony_ci        parent.setAttribute('check-type', '1');
1185fb726d48Sopenharmony_ci        parent.rangeSelect = false;
1186fb726d48Sopenharmony_ci        parent.checkBoxEL!.checked = false;
1187fb726d48Sopenharmony_ci        parent.checkBoxEL!.indeterminate = true;
1188fb726d48Sopenharmony_ci      }
1189fb726d48Sopenharmony_ci    }
1190fb726d48Sopenharmony_ci  }
1191fb726d48Sopenharmony_ci
1192fb726d48Sopenharmony_ci  /**
1193fb726d48Sopenharmony_ci   * 处理点击checkbox的逻辑
1194fb726d48Sopenharmony_ci   * @param row 当前点击checkbox的row
1195fb726d48Sopenharmony_ci   */
1196fb726d48Sopenharmony_ci  // @ts-ignore
1197fb726d48Sopenharmony_ci  selectChangeHandler = (row: TraceRow<unknown>): void => {
1198fb726d48Sopenharmony_ci    this.setParentCheckStatus(row);
1199fb726d48Sopenharmony_ci    // @ts-ignore
1200fb726d48Sopenharmony_ci    const foldSelectParentRowList: Array<TraceRow<unknown>> = this.shadowRoot!.querySelectorAll<TraceRow<unknown>>("trace-row[check-type='1']");
1201fb726d48Sopenharmony_ci    // @ts-ignore
1202fb726d48Sopenharmony_ci    const foldSelectRowList: Array<TraceRow<unknown>> = [];
1203fb726d48Sopenharmony_ci    // @ts-ignore
1204fb726d48Sopenharmony_ci    foldSelectParentRowList.length && foldSelectParentRowList.forEach((item) => item.childrenList.filter((child: { checkType: string }) => child!.checkType === '2' && foldSelectRowList.push(child)));
1205fb726d48Sopenharmony_ci    const rows = [
1206fb726d48Sopenharmony_ci      ...foldSelectRowList,
1207fb726d48Sopenharmony_ci      // @ts-ignore
1208fb726d48Sopenharmony_ci      ...this.shadowRoot!.querySelectorAll<TraceRow<unknown>>("trace-row[check-type='2']"),
1209fb726d48Sopenharmony_ci      ...this.favoriteChartListEL!.getAllSelectCollectRows(),
1210fb726d48Sopenharmony_ci    ];
1211fb726d48Sopenharmony_ci    this.isSelectClick = true;
1212fb726d48Sopenharmony_ci    this.rangeSelect.rangeTraceRow = rows;
1213fb726d48Sopenharmony_ci    this.rangeSelect.checkRowsName(this.rangeSelect.rangeTraceRow);
1214fb726d48Sopenharmony_ci    // @ts-ignore
1215fb726d48Sopenharmony_ci    let changeTraceRows: Array<TraceRow<unknown>> = [];
1216fb726d48Sopenharmony_ci    if (this.rangeTraceRow!.length < rows.length) {
1217fb726d48Sopenharmony_ci      // @ts-ignore
1218fb726d48Sopenharmony_ci      rows!.forEach((currentTraceRow: TraceRow<unknown>) => {
1219fb726d48Sopenharmony_ci        let changeFilter = this.rangeTraceRow!.filter(
1220fb726d48Sopenharmony_ci          // @ts-ignore
1221fb726d48Sopenharmony_ci          (prevTraceRow: TraceRow<unknown>) => prevTraceRow === currentTraceRow
1222fb726d48Sopenharmony_ci        );
1223fb726d48Sopenharmony_ci        if (changeFilter.length < 1) {
1224fb726d48Sopenharmony_ci          changeTraceRows.push(currentTraceRow);
1225fb726d48Sopenharmony_ci        }
1226fb726d48Sopenharmony_ci      });
1227fb726d48Sopenharmony_ci      if (changeTraceRows.length > 0) {
1228fb726d48Sopenharmony_ci        // @ts-ignore
1229fb726d48Sopenharmony_ci        changeTraceRows!.forEach((changeTraceRow: TraceRow<unknown>) => {
1230fb726d48Sopenharmony_ci          let pointEvent = this.createPointEvent(changeTraceRow);
1231fb726d48Sopenharmony_ci          SpStatisticsHttpUtil.addOrdinaryVisitAction({
1232fb726d48Sopenharmony_ci            action: 'trace_row', // @ts-ignore
1233fb726d48Sopenharmony_ci            event: pointEvent,
1234fb726d48Sopenharmony_ci          });
1235fb726d48Sopenharmony_ci        });
1236fb726d48Sopenharmony_ci      }
1237fb726d48Sopenharmony_ci    }
1238fb726d48Sopenharmony_ci    this.rangeTraceRow = rows;
1239fb726d48Sopenharmony_ci    let search = document.querySelector('body > sp-application')!.shadowRoot!.querySelector<LitSearch>('#lit-search');
1240fb726d48Sopenharmony_ci    if (search?.isClearValue) {
1241fb726d48Sopenharmony_ci      spSystemTraceDocumentOnMouseMoveMouseDown(this, search!);
1242fb726d48Sopenharmony_ci    }
1243fb726d48Sopenharmony_ci    this.rangeSelect.selectHandler?.(this.rangeSelect.rangeTraceRow, false);
1244fb726d48Sopenharmony_ci  };
1245fb726d48Sopenharmony_ci  inFavoriteArea: boolean | undefined;
1246fb726d48Sopenharmony_ci  documentOnMouseMove = (ev: MouseEvent): void => spSystemTraceDocumentOnMouseMove(this, ev);
1247fb726d48Sopenharmony_ci
1248fb726d48Sopenharmony_ci  hoverStructNull(): SpSystemTrace {
1249fb726d48Sopenharmony_ci    CpuStruct.hoverCpuStruct = undefined;
1250fb726d48Sopenharmony_ci    CpuFreqStruct.hoverCpuFreqStruct = undefined;
1251fb726d48Sopenharmony_ci    ThreadStruct.hoverThreadStruct = undefined;
1252fb726d48Sopenharmony_ci    FuncStruct.hoverFuncStruct = undefined;
1253fb726d48Sopenharmony_ci    ProcessMemStruct.hoverProcessMemStruct = undefined;
1254fb726d48Sopenharmony_ci    HiPerfCpuStruct.hoverStruct = undefined;
1255fb726d48Sopenharmony_ci    HiPerfProcessStruct.hoverStruct = undefined;
1256fb726d48Sopenharmony_ci    HiPerfThreadStruct.hoverStruct = undefined;
1257fb726d48Sopenharmony_ci    HiPerfEventStruct.hoverStruct = undefined;
1258fb726d48Sopenharmony_ci    HiPerfReportStruct.hoverStruct = undefined;
1259fb726d48Sopenharmony_ci    CpuStateStruct.hoverStateStruct = undefined;
1260fb726d48Sopenharmony_ci    CpuAbilityMonitorStruct.hoverCpuAbilityStruct = undefined;
1261fb726d48Sopenharmony_ci    DiskAbilityMonitorStruct.hoverDiskAbilityStruct = undefined;
1262fb726d48Sopenharmony_ci    MemoryAbilityMonitorStruct.hoverMemoryAbilityStruct = undefined;
1263fb726d48Sopenharmony_ci    NetworkAbilityMonitorStruct.hoverNetworkAbilityStruct = undefined;
1264fb726d48Sopenharmony_ci    CpuFreqLimitsStruct.hoverCpuFreqLimitsStruct = undefined;
1265fb726d48Sopenharmony_ci    FpsStruct.hoverFpsStruct = undefined;
1266fb726d48Sopenharmony_ci    ClockStruct.hoverClockStruct = undefined;
1267fb726d48Sopenharmony_ci    IrqStruct.hoverIrqStruct = undefined;
1268fb726d48Sopenharmony_ci    HeapStruct.hoverHeapStruct = undefined;
1269fb726d48Sopenharmony_ci    JankStruct.hoverJankStruct = undefined;
1270fb726d48Sopenharmony_ci    AppStartupStruct.hoverStartupStruct = undefined;
1271fb726d48Sopenharmony_ci    SoStruct.hoverSoStruct = undefined;
1272fb726d48Sopenharmony_ci    HeapSnapshotStruct.hoverSnapshotStruct = undefined;
1273fb726d48Sopenharmony_ci    FrameAnimationStruct.hoverFrameAnimationStruct = undefined;
1274fb726d48Sopenharmony_ci    FrameDynamicStruct.hoverFrameDynamicStruct = undefined;
1275fb726d48Sopenharmony_ci    FrameSpacingStruct.hoverFrameSpacingStruct = undefined;
1276fb726d48Sopenharmony_ci    JsCpuProfilerStruct.hoverJsCpuProfilerStruct = undefined;
1277fb726d48Sopenharmony_ci    SnapshotStruct.hoverSnapshotStruct = undefined;
1278fb726d48Sopenharmony_ci    HiPerfCallChartStruct.hoverPerfCallCutStruct = undefined;
1279fb726d48Sopenharmony_ci    SampleStruct.hoverSampleStruct = undefined;
1280fb726d48Sopenharmony_ci    PerfToolStruct.hoverPerfToolStruct = undefined;
1281fb726d48Sopenharmony_ci    GpuCounterStruct.hoverGpuCounterStruct = undefined;
1282fb726d48Sopenharmony_ci    DmaFenceStruct.hoverDmaFenceStruct = undefined;//清空hover slice
1283fb726d48Sopenharmony_ci    this.tipEL!.style.display = 'none';
1284fb726d48Sopenharmony_ci    return this;
1285fb726d48Sopenharmony_ci  }
1286fb726d48Sopenharmony_ci
1287fb726d48Sopenharmony_ci  selectStructNull(): SpSystemTrace {
1288fb726d48Sopenharmony_ci    CpuStruct.selectCpuStruct = undefined;
1289fb726d48Sopenharmony_ci    CpuStruct.wakeupBean = null;
1290fb726d48Sopenharmony_ci    CpuFreqStruct.selectCpuFreqStruct = undefined;
1291fb726d48Sopenharmony_ci    ThreadStruct.selectThreadStruct = undefined;
1292fb726d48Sopenharmony_ci    ThreadStruct.isClickPrio = false;
1293fb726d48Sopenharmony_ci    FuncStruct.selectFuncStruct = undefined;
1294fb726d48Sopenharmony_ci    SpHiPerf.selectCpuStruct = undefined;
1295fb726d48Sopenharmony_ci    CpuStateStruct.selectStateStruct = undefined;
1296fb726d48Sopenharmony_ci    CpuFreqLimitsStruct.selectCpuFreqLimitsStruct = undefined;
1297fb726d48Sopenharmony_ci    ClockStruct.selectClockStruct = undefined;
1298fb726d48Sopenharmony_ci    HangStruct.selectHangStruct = undefined;
1299fb726d48Sopenharmony_ci    IrqStruct.selectIrqStruct = undefined;
1300fb726d48Sopenharmony_ci    JankStruct.selectJankStruct = undefined;
1301fb726d48Sopenharmony_ci    HeapStruct.selectHeapStruct = undefined;
1302fb726d48Sopenharmony_ci    AppStartupStruct.selectStartupStruct = undefined;
1303fb726d48Sopenharmony_ci    SoStruct.selectSoStruct = undefined;
1304fb726d48Sopenharmony_ci    HeapSnapshotStruct.selectSnapshotStruct = undefined;
1305fb726d48Sopenharmony_ci    FrameSpacingStruct.selectFrameSpacingStruct = undefined;
1306fb726d48Sopenharmony_ci    FrameAnimationStruct.selectFrameAnimationStruct = undefined;
1307fb726d48Sopenharmony_ci    FrameDynamicStruct.selectFrameDynamicStruct = undefined;
1308fb726d48Sopenharmony_ci    JsCpuProfilerStruct.selectJsCpuProfilerStruct = undefined;
1309fb726d48Sopenharmony_ci    SnapshotStruct.selectSnapshotStruct = undefined;
1310fb726d48Sopenharmony_ci    HiPerfCallChartStruct.selectStruct = undefined;
1311fb726d48Sopenharmony_ci    AllAppStartupStruct.selectStartupStruct = undefined;
1312fb726d48Sopenharmony_ci    LtpoStruct.selectLtpoStruct = undefined;
1313fb726d48Sopenharmony_ci    HitchTimeStruct.selectHitchTimeStruct = undefined;
1314fb726d48Sopenharmony_ci    SampleStruct.selectSampleStruct = undefined;
1315fb726d48Sopenharmony_ci    PerfToolStruct.selectPerfToolStruct = undefined;
1316fb726d48Sopenharmony_ci    GpuCounterStruct.selectGpuCounterStruct = undefined;
1317fb726d48Sopenharmony_ci    DmaFenceStruct.selectDmaFenceStruct = undefined;//清空选中slice
1318fb726d48Sopenharmony_ci    return this;
1319fb726d48Sopenharmony_ci  }
1320fb726d48Sopenharmony_ci
1321fb726d48Sopenharmony_ci  isWASDKeyPress(): boolean | undefined {
1322fb726d48Sopenharmony_ci    return (
1323fb726d48Sopenharmony_ci      this.keyPressMap.get('w') || this.keyPressMap.get('a') || this.keyPressMap.get('d') || this.keyPressMap.get('s')
1324fb726d48Sopenharmony_ci    );
1325fb726d48Sopenharmony_ci  }
1326fb726d48Sopenharmony_ci
1327fb726d48Sopenharmony_ci  documentOnClick = (ev: MouseEvent): void => spSystemTraceDocumentOnClick(this, ev);
1328fb726d48Sopenharmony_ci
1329fb726d48Sopenharmony_ci  clickEmptyArea(): void {
1330fb726d48Sopenharmony_ci    this.queryAllTraceRow().forEach((it) => {
1331fb726d48Sopenharmony_ci      it.checkType = '-1';
1332fb726d48Sopenharmony_ci      it.rangeSelect = false;
1333fb726d48Sopenharmony_ci    });
1334fb726d48Sopenharmony_ci    this.rangeSelect.rangeTraceRow = [];
1335fb726d48Sopenharmony_ci    TraceRow.rangeSelectObject = undefined;
1336fb726d48Sopenharmony_ci    SpAiAnalysisPage.selectChangeListener(TraceRow.range?.startNS!, TraceRow.range?.endNS!);
1337fb726d48Sopenharmony_ci    this.selectStructNull();
1338fb726d48Sopenharmony_ci    this.wakeupListNull();
1339fb726d48Sopenharmony_ci    this.observerScrollHeightEnable = false;
1340fb726d48Sopenharmony_ci    this.selectFlag = null;
1341fb726d48Sopenharmony_ci    this.timerShaftEL?.removeTriangle('inverted');
1342fb726d48Sopenharmony_ci    //   如果鼠标在SportRuler区域不隐藏tab页
1343fb726d48Sopenharmony_ci    if (!SportRuler.isMouseInSportRuler) {
1344fb726d48Sopenharmony_ci      this.traceSheetEL?.setMode('hidden');
1345fb726d48Sopenharmony_ci    }
1346fb726d48Sopenharmony_ci    this.removeLinkLinesByBusinessType('task', 'thread', 'func');
1347fb726d48Sopenharmony_ci    this.removeLinkLinesByBusinessType('task', 'thread', 'distributed');
1348fb726d48Sopenharmony_ci    this.refreshCanvas(true, 'click empty');
1349fb726d48Sopenharmony_ci    JankStruct.delJankLineFlag = true;
1350fb726d48Sopenharmony_ci  }
1351fb726d48Sopenharmony_ci
1352fb726d48Sopenharmony_ci  //泳道图点击判定条件
1353fb726d48Sopenharmony_ci  traceRowClickJudgmentConditions: Map<string, () => boolean> = new Map<string, () => boolean>([
1354fb726d48Sopenharmony_ci    [TraceRow.ROW_TYPE_CPU, (): boolean => CpuStruct.hoverCpuStruct !== null && CpuStruct.hoverCpuStruct !== undefined],
1355fb726d48Sopenharmony_ci    [
1356fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_THREAD,
1357fb726d48Sopenharmony_ci      (): boolean => ThreadStruct.hoverThreadStruct !== null && ThreadStruct.hoverThreadStruct !== undefined,
1358fb726d48Sopenharmony_ci    ],
1359fb726d48Sopenharmony_ci    [
1360fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_FUNC,
1361fb726d48Sopenharmony_ci      (): boolean => FuncStruct.hoverFuncStruct !== null && FuncStruct.hoverFuncStruct !== undefined,
1362fb726d48Sopenharmony_ci    ],
1363fb726d48Sopenharmony_ci    [
1364fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_SAMPLE,
1365fb726d48Sopenharmony_ci      (): boolean => SampleStruct.hoverSampleStruct !== null && SampleStruct.hoverSampleStruct !== undefined,
1366fb726d48Sopenharmony_ci    ],
1367fb726d48Sopenharmony_ci    [
1368fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_GPU_COUNTER,
1369fb726d48Sopenharmony_ci      (): boolean =>
1370fb726d48Sopenharmony_ci        GpuCounterStruct.hoverGpuCounterStruct !== null && GpuCounterStruct.hoverGpuCounterStruct !== undefined,
1371fb726d48Sopenharmony_ci    ],
1372fb726d48Sopenharmony_ci    [
1373fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_CPU_FREQ,
1374fb726d48Sopenharmony_ci      (): boolean => CpuFreqStruct.hoverCpuFreqStruct !== null && CpuFreqStruct.hoverCpuFreqStruct !== undefined,
1375fb726d48Sopenharmony_ci    ],
1376fb726d48Sopenharmony_ci    [
1377fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_CPU_STATE,
1378fb726d48Sopenharmony_ci      (): boolean => CpuStateStruct.hoverStateStruct !== null && CpuStateStruct.hoverStateStruct !== undefined,
1379fb726d48Sopenharmony_ci    ],
1380fb726d48Sopenharmony_ci    [
1381fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_CPU_FREQ_LIMIT,
1382fb726d48Sopenharmony_ci      (): boolean =>
1383fb726d48Sopenharmony_ci        CpuFreqLimitsStruct.hoverCpuFreqLimitsStruct !== null &&
1384fb726d48Sopenharmony_ci        CpuFreqLimitsStruct.hoverCpuFreqLimitsStruct !== undefined,
1385fb726d48Sopenharmony_ci    ],
1386fb726d48Sopenharmony_ci    [
1387fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_CLOCK,
1388fb726d48Sopenharmony_ci      (): boolean => ClockStruct.hoverClockStruct !== null && ClockStruct.hoverClockStruct !== undefined,
1389fb726d48Sopenharmony_ci    ],
1390fb726d48Sopenharmony_ci    [TraceRow.ROW_TYPE_IRQ, (): boolean => IrqStruct.hoverIrqStruct !== null && IrqStruct.hoverIrqStruct !== undefined],
1391fb726d48Sopenharmony_ci    [
1392fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_APP_STARTUP,
1393fb726d48Sopenharmony_ci      (): boolean => AppStartupStruct.hoverStartupStruct !== null && AppStartupStruct.hoverStartupStruct !== undefined,
1394fb726d48Sopenharmony_ci    ],
1395fb726d48Sopenharmony_ci    [
1396fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_ALL_APPSTARTUPS,
1397fb726d48Sopenharmony_ci      (): boolean =>
1398fb726d48Sopenharmony_ci        AllAppStartupStruct.hoverStartupStruct !== null && AllAppStartupStruct.hoverStartupStruct !== undefined,
1399fb726d48Sopenharmony_ci    ],
1400fb726d48Sopenharmony_ci    [
1401fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_STATIC_INIT,
1402fb726d48Sopenharmony_ci      (): boolean => SoStruct.hoverSoStruct !== null && SoStruct.hoverSoStruct !== undefined,
1403fb726d48Sopenharmony_ci    ],
1404fb726d48Sopenharmony_ci    [
1405fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_JANK,
1406fb726d48Sopenharmony_ci      (): boolean => JankStruct.hoverJankStruct !== null && JankStruct.hoverJankStruct !== undefined,
1407fb726d48Sopenharmony_ci    ],
1408fb726d48Sopenharmony_ci    [
1409fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_HEAP,
1410fb726d48Sopenharmony_ci      (): boolean => HeapStruct.hoverHeapStruct !== null && HeapStruct.hoverHeapStruct !== undefined,
1411fb726d48Sopenharmony_ci    ],
1412fb726d48Sopenharmony_ci    [
1413fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_SYS_MEMORY_GPU_TOTAL,
1414fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1415fb726d48Sopenharmony_ci    ],
1416fb726d48Sopenharmony_ci    [
1417fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_SYS_MEMORY_GPU_WINDOW,
1418fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1419fb726d48Sopenharmony_ci    ],
1420fb726d48Sopenharmony_ci    [
1421fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_HEAP_SNAPSHOT,
1422fb726d48Sopenharmony_ci      (): boolean =>
1423fb726d48Sopenharmony_ci        HeapSnapshotStruct.hoverSnapshotStruct !== null && HeapSnapshotStruct.hoverSnapshotStruct !== undefined,
1424fb726d48Sopenharmony_ci    ],
1425fb726d48Sopenharmony_ci    [
1426fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_FRAME_ANIMATION,
1427fb726d48Sopenharmony_ci      (): boolean =>
1428fb726d48Sopenharmony_ci        FrameAnimationStruct.hoverFrameAnimationStruct !== null &&
1429fb726d48Sopenharmony_ci        FrameAnimationStruct.hoverFrameAnimationStruct !== undefined,
1430fb726d48Sopenharmony_ci    ],
1431fb726d48Sopenharmony_ci    [
1432fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_FRAME_DYNAMIC,
1433fb726d48Sopenharmony_ci      (): boolean =>
1434fb726d48Sopenharmony_ci        FrameDynamicStruct.hoverFrameDynamicStruct !== null && FrameDynamicStruct.hoverFrameDynamicStruct !== undefined,
1435fb726d48Sopenharmony_ci    ],
1436fb726d48Sopenharmony_ci    [
1437fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_FRAME_SPACING,
1438fb726d48Sopenharmony_ci      (): boolean =>
1439fb726d48Sopenharmony_ci        FrameSpacingStruct.hoverFrameSpacingStruct !== null && FrameSpacingStruct.hoverFrameSpacingStruct !== undefined,
1440fb726d48Sopenharmony_ci    ],
1441fb726d48Sopenharmony_ci    [
1442fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_JS_CPU_PROFILER,
1443fb726d48Sopenharmony_ci      (): boolean =>
1444fb726d48Sopenharmony_ci        JsCpuProfilerStruct.hoverJsCpuProfilerStruct !== null &&
1445fb726d48Sopenharmony_ci        JsCpuProfilerStruct.hoverJsCpuProfilerStruct !== undefined,
1446fb726d48Sopenharmony_ci    ],
1447fb726d48Sopenharmony_ci    [
1448fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_PURGEABLE_TOTAL_ABILITY,
1449fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1450fb726d48Sopenharmony_ci    ],
1451fb726d48Sopenharmony_ci    [
1452fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_PURGEABLE_PIN_ABILITY,
1453fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1454fb726d48Sopenharmony_ci    ],
1455fb726d48Sopenharmony_ci    [
1456fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_PURGEABLE_TOTAL_VM,
1457fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1458fb726d48Sopenharmony_ci    ],
1459fb726d48Sopenharmony_ci    [
1460fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_PURGEABLE_PIN_VM,
1461fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1462fb726d48Sopenharmony_ci    ],
1463fb726d48Sopenharmony_ci    [
1464fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_DMA_ABILITY,
1465fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1466fb726d48Sopenharmony_ci    ],
1467fb726d48Sopenharmony_ci    [
1468fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_DMA_VMTRACKER,
1469fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1470fb726d48Sopenharmony_ci    ],
1471fb726d48Sopenharmony_ci    [
1472fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_GPU_MEMORY_ABILITY,
1473fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1474fb726d48Sopenharmony_ci    ],
1475fb726d48Sopenharmony_ci    [
1476fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_GPU_MEMORY_VMTRACKER,
1477fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1478fb726d48Sopenharmony_ci    ],
1479fb726d48Sopenharmony_ci    [
1480fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_GPU_RESOURCE_VMTRACKER,
1481fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1482fb726d48Sopenharmony_ci    ],
1483fb726d48Sopenharmony_ci    [
1484fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_VMTRACKER_SHM,
1485fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1486fb726d48Sopenharmony_ci    ],
1487fb726d48Sopenharmony_ci    [
1488fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_VM_TRACKER_SMAPS,
1489fb726d48Sopenharmony_ci      (): boolean => SnapshotStruct.hoverSnapshotStruct !== null && SnapshotStruct.hoverSnapshotStruct !== undefined,
1490fb726d48Sopenharmony_ci    ],
1491fb726d48Sopenharmony_ci    [
1492fb726d48Sopenharmony_ci      TraceRow.ROW_TYPE_HANG,
1493fb726d48Sopenharmony_ci      (): boolean => HangStruct.hoverHangStruct !== null && HangStruct.hoverHangStruct !== undefined,
1494fb726d48Sopenharmony_ci    ],
1495fb726d48Sopenharmony_ci  ]);
1496fb726d48Sopenharmony_ci
1497fb726d48Sopenharmony_ci  // @ts-ignore
1498fb726d48Sopenharmony_ci  onClickHandler(clickRowType: string, row?: TraceRow<unknown>, entry?: unknown): void {
1499fb726d48Sopenharmony_ci    spSystemTraceOnClickHandler(this, clickRowType, row as TraceRow<BaseStruct>, entry);
1500fb726d48Sopenharmony_ci  }
1501fb726d48Sopenharmony_ci
1502fb726d48Sopenharmony_ci  makePoint(
1503fb726d48Sopenharmony_ci    ts: number,
1504fb726d48Sopenharmony_ci    dur: number,
1505fb726d48Sopenharmony_ci    translateY: number,
1506fb726d48Sopenharmony_ci    rowStruct: unknown,
1507fb726d48Sopenharmony_ci    offsetY: number,
1508fb726d48Sopenharmony_ci    business: string,
1509fb726d48Sopenharmony_ci    lineType: LineType,
1510fb726d48Sopenharmony_ci    isRight: boolean
1511fb726d48Sopenharmony_ci  ): PairPoint {
1512fb726d48Sopenharmony_ci    return {
1513fb726d48Sopenharmony_ci      x: ns2xByTimeShaft(ts + dur, this.timerShaftEL!),
1514fb726d48Sopenharmony_ci      y: translateY!,
1515fb726d48Sopenharmony_ci      offsetY: offsetY,
1516fb726d48Sopenharmony_ci      ns: ts + dur, // @ts-ignore
1517fb726d48Sopenharmony_ci      rowEL: rowStruct!,
1518fb726d48Sopenharmony_ci      isRight: isRight,
1519fb726d48Sopenharmony_ci      business: business,
1520fb726d48Sopenharmony_ci      lineType: lineType,
1521fb726d48Sopenharmony_ci    };
1522fb726d48Sopenharmony_ci  }
1523fb726d48Sopenharmony_ci  // @ts-ignore
1524fb726d48Sopenharmony_ci  drawTaskPollLine(row?: TraceRow<unknown>): void {
1525fb726d48Sopenharmony_ci    spSystemTraceDrawTaskPollLine(this, row);
1526fb726d48Sopenharmony_ci  }
1527fb726d48Sopenharmony_ci  drawJankLine(
1528fb726d48Sopenharmony_ci    endParentRow: unknown,
1529fb726d48Sopenharmony_ci    selectJankStruct: JankStruct,
1530fb726d48Sopenharmony_ci    data: unknown,
1531fb726d48Sopenharmony_ci    isBinderClick: boolean = false
1532fb726d48Sopenharmony_ci  ): void {
1533fb726d48Sopenharmony_ci    spSystemTraceDrawJankLine(this, endParentRow, selectJankStruct, data, isBinderClick);
1534fb726d48Sopenharmony_ci  }
1535fb726d48Sopenharmony_ci
1536fb726d48Sopenharmony_ci  drawDistributedLine(
1537fb726d48Sopenharmony_ci    sourceData: FuncStruct,
1538fb726d48Sopenharmony_ci    targetData: FuncStruct,
1539fb726d48Sopenharmony_ci    selectFuncStruct: FuncStruct,
1540fb726d48Sopenharmony_ci  ): void {
1541fb726d48Sopenharmony_ci    spSystemTraceDrawDistributedLine(this, sourceData, targetData, selectFuncStruct);
1542fb726d48Sopenharmony_ci  }
1543fb726d48Sopenharmony_ci
1544fb726d48Sopenharmony_ci  drawThreadLine(endParentRow: unknown, selectThreadStruct: ThreadStruct | undefined, data: unknown): void {
1545fb726d48Sopenharmony_ci    spSystemTraceDrawThreadLine(this, endParentRow, selectThreadStruct, data);
1546fb726d48Sopenharmony_ci  }
1547fb726d48Sopenharmony_ci
1548fb726d48Sopenharmony_ci  drawFuncLine(endParentRow: unknown, selectFuncStruct: FuncStruct | undefined, data: unknown, binderTid: Number): void {
1549fb726d48Sopenharmony_ci    spSystemTraceDrawFuncLine(this, endParentRow, selectFuncStruct, data, binderTid);
1550fb726d48Sopenharmony_ci  }
1551fb726d48Sopenharmony_ci
1552fb726d48Sopenharmony_ci  getStartRow(selectRowId: number | undefined, collectList: unknown[]): unknown {
1553fb726d48Sopenharmony_ci    let startRow = this.shadowRoot?.querySelector<TraceRow<ThreadStruct>>(
1554fb726d48Sopenharmony_ci      `trace-row[row-id='${selectRowId}'][row-type='thread']`
1555fb726d48Sopenharmony_ci    );
1556fb726d48Sopenharmony_ci    if (!startRow) {
1557fb726d48Sopenharmony_ci      for (let collectChart of collectList) {
1558fb726d48Sopenharmony_ci        // @ts-ignore
1559fb726d48Sopenharmony_ci        if (collectChart.rowId === selectRowId?.toString() && collectChart.rowType === 'thread') {
1560fb726d48Sopenharmony_ci          // @ts-ignore
1561fb726d48Sopenharmony_ci          startRow = collectChart;
1562fb726d48Sopenharmony_ci          break;
1563fb726d48Sopenharmony_ci        }
1564fb726d48Sopenharmony_ci      }
1565fb726d48Sopenharmony_ci    }
1566fb726d48Sopenharmony_ci    return startRow;
1567fb726d48Sopenharmony_ci  }
1568fb726d48Sopenharmony_ci
1569fb726d48Sopenharmony_ci  calculateStartY(startRow: unknown, pid: number | undefined, selectFuncStruct?: FuncStruct): [number, unknown, number] {
1570fb726d48Sopenharmony_ci    // @ts-ignore
1571fb726d48Sopenharmony_ci    let startY = startRow ? startRow!.translateY! : 0;
1572fb726d48Sopenharmony_ci    let startRowEl = startRow;
1573fb726d48Sopenharmony_ci    let startOffSetY = selectFuncStruct ? 20 * (0.5 + Number(selectFuncStruct.depth)) : 20 * 0.5;
1574fb726d48Sopenharmony_ci    // @ts-ignore
1575fb726d48Sopenharmony_ci    const startParentRow = startRow ? this.shadowRoot?.querySelector<TraceRow<ThreadStruct>>(`trace-row[row-id='${startRow.rowParentId}'][folder]`) : this.shadowRoot?.querySelector<TraceRow<ThreadStruct>>(
1576fb726d48Sopenharmony_ci      `trace-row[row-id='${pid}'][folder]`
1577fb726d48Sopenharmony_ci    );
1578fb726d48Sopenharmony_ci    const expansionFlag = this.collectionHasThread(startRow);
1579fb726d48Sopenharmony_ci    if (startParentRow && !startParentRow.expansion && expansionFlag) {
1580fb726d48Sopenharmony_ci      startY = startParentRow.translateY!;
1581fb726d48Sopenharmony_ci      startRowEl = startParentRow;
1582fb726d48Sopenharmony_ci      startOffSetY = selectFuncStruct ? 10 * (0.5 + Number(selectFuncStruct.depth)) : 10 * 0.5;
1583fb726d48Sopenharmony_ci    }
1584fb726d48Sopenharmony_ci    return [startY, startRowEl, startOffSetY];
1585fb726d48Sopenharmony_ci  }
1586fb726d48Sopenharmony_ci
1587fb726d48Sopenharmony_ci  calculateEndY(endParentRow: unknown, endRowStruct: unknown, data?: unknown): [number, unknown, number] {
1588fb726d48Sopenharmony_ci    // @ts-ignore
1589fb726d48Sopenharmony_ci    let endY = endRowStruct.translateY!;
1590fb726d48Sopenharmony_ci    let endRowEl = endRowStruct;
1591fb726d48Sopenharmony_ci    // @ts-ignore
1592fb726d48Sopenharmony_ci    let endOffSetY = data ? 20 * (0.5 + Number(data.depth)) : 20 * 0.5;
1593fb726d48Sopenharmony_ci    const expansionFlag = this.collectionHasThread(endRowStruct);
1594fb726d48Sopenharmony_ci    // @ts-ignore
1595fb726d48Sopenharmony_ci    if (!endParentRow.expansion && expansionFlag) {
1596fb726d48Sopenharmony_ci      // @ts-ignore
1597fb726d48Sopenharmony_ci      endY = endParentRow.translateY!;
1598fb726d48Sopenharmony_ci      endRowEl = endParentRow;
1599fb726d48Sopenharmony_ci      // @ts-ignore
1600fb726d48Sopenharmony_ci      endOffSetY = data ? 10 * (0.5 + Number(data.depth)) : 10 * 0.5;
1601fb726d48Sopenharmony_ci    }
1602fb726d48Sopenharmony_ci    return [endY, endRowEl, endOffSetY];
1603fb726d48Sopenharmony_ci  }
1604fb726d48Sopenharmony_ci
1605fb726d48Sopenharmony_ci  collectionHasThread(threadRow: unknown): boolean {
1606fb726d48Sopenharmony_ci    const collectList = this.favoriteChartListEL!.getCollectRows();
1607fb726d48Sopenharmony_ci    for (let item of collectList!) {
1608fb726d48Sopenharmony_ci      // @ts-ignore
1609fb726d48Sopenharmony_ci      if (threadRow && item.rowId === threadRow.rowId && item.rowType === threadRow.rowType) {
1610fb726d48Sopenharmony_ci        return false;
1611fb726d48Sopenharmony_ci      }
1612fb726d48Sopenharmony_ci    }
1613fb726d48Sopenharmony_ci    return true;
1614fb726d48Sopenharmony_ci  }
1615fb726d48Sopenharmony_ci
1616fb726d48Sopenharmony_ci  translateByMouseMove(ev: MouseEvent): void {
1617fb726d48Sopenharmony_ci    ev.preventDefault();
1618fb726d48Sopenharmony_ci    let offset = 0;
1619fb726d48Sopenharmony_ci    if (this.offsetMouse === 0) {
1620fb726d48Sopenharmony_ci      this.offsetMouse = ev.clientX;
1621fb726d48Sopenharmony_ci      offset = ev.clientX - this.mouseCurrentPosition;
1622fb726d48Sopenharmony_ci    } else {
1623fb726d48Sopenharmony_ci      offset = ev.clientX - this.offsetMouse;
1624fb726d48Sopenharmony_ci    }
1625fb726d48Sopenharmony_ci    this.offsetMouse = ev.clientX;
1626fb726d48Sopenharmony_ci    const rangeRuler = this.timerShaftEL?.getRangeRuler()!;
1627fb726d48Sopenharmony_ci    rangeRuler.translate(offset);
1628fb726d48Sopenharmony_ci  }
1629fb726d48Sopenharmony_ci
1630fb726d48Sopenharmony_ci  private eventListener(): void {
1631fb726d48Sopenharmony_ci    /**
1632fb726d48Sopenharmony_ci     * 监听时间轴区间变化
1633fb726d48Sopenharmony_ci     */
1634fb726d48Sopenharmony_ci    this.timerShaftEL!.rangeChangeHandler = this.timerShaftELRangeChange;
1635fb726d48Sopenharmony_ci    this.timerShaftEL!.rangeClickHandler = this.timerShaftELRangeClick;
1636fb726d48Sopenharmony_ci    this.timerShaftEL!.flagChangeHandler = this.timerShaftELFlagChange;
1637fb726d48Sopenharmony_ci    this.timerShaftEL!.flagClickHandler = this.timerShaftELFlagClickHandler;
1638fb726d48Sopenharmony_ci    /**
1639fb726d48Sopenharmony_ci     * 监听rowsEL的滚动时间,刷新可见区域的trace-row组件的时间区间(将触发trace-row组件重绘)
1640fb726d48Sopenharmony_ci     */
1641fb726d48Sopenharmony_ci    this.rowsPaneEL?.addEventListener('scroll', this.rowsElOnScroll, {
1642fb726d48Sopenharmony_ci      passive: true,
1643fb726d48Sopenharmony_ci    });
1644fb726d48Sopenharmony_ci    this.favoriteChartListEL?.addEventListener('scroll', this.favoriteRowsElOnScroll, {
1645fb726d48Sopenharmony_ci      passive: true,
1646fb726d48Sopenharmony_ci    });
1647fb726d48Sopenharmony_ci    /**
1648fb726d48Sopenharmony_ci     * 监听document的mousemove事件 坐标通过换算后找到当前鼠标所在的trace-row组件,将坐标传入
1649fb726d48Sopenharmony_ci     */
1650fb726d48Sopenharmony_ci    this.addEventListener('mousemove', this.documentOnMouseMove);
1651fb726d48Sopenharmony_ci    this.addEventListener('click', this.documentOnClick);
1652fb726d48Sopenharmony_ci    this.addEventListener('mousedown', this.documentOnMouseDown);
1653fb726d48Sopenharmony_ci    this.addEventListener('mouseup', this.documentOnMouseUp);
1654fb726d48Sopenharmony_ci    this.addEventListener('mouseout', this.documentOnMouseOut);
1655fb726d48Sopenharmony_ci    document.addEventListener('keydown', this.documentOnKeyDown);
1656fb726d48Sopenharmony_ci    document.addEventListener('keypress', this.documentOnKeyPress);
1657fb726d48Sopenharmony_ci    document.addEventListener('keyup', this.documentOnKeyUp);
1658fb726d48Sopenharmony_ci    document.addEventListener('contextmenu', this.onContextMenuHandler);
1659fb726d48Sopenharmony_ci    this.wheelListener();
1660fb726d48Sopenharmony_ci  }
1661fb726d48Sopenharmony_ci
1662fb726d48Sopenharmony_ci  private subRecordExportListener(): void {
1663fb726d48Sopenharmony_ci    window.subscribe(window.SmartEvent.UI.ExportRecord, (params) => {
1664fb726d48Sopenharmony_ci      let range = this.timerShaftEL?.rangeRuler?.range;
1665fb726d48Sopenharmony_ci      if (range) {
1666fb726d48Sopenharmony_ci        let expandRows =
1667fb726d48Sopenharmony_ci          Array.from(this.rowsEL!.querySelectorAll<TraceRow<BaseStruct>>('trace-row[folder][expansion]')) || [];
1668fb726d48Sopenharmony_ci        let data = JSON.stringify({
1669fb726d48Sopenharmony_ci          leftNS: range.startNS,
1670fb726d48Sopenharmony_ci          rightNS: range.endNS,
1671fb726d48Sopenharmony_ci          G1: this.favoriteChartListEL!.getCollectRowsInfo('1'),
1672fb726d48Sopenharmony_ci          G2: this.favoriteChartListEL!.getCollectRowsInfo('2'),
1673fb726d48Sopenharmony_ci          expand: expandRows.map((row) => {
1674fb726d48Sopenharmony_ci            return {
1675fb726d48Sopenharmony_ci              type: row.rowType,
1676fb726d48Sopenharmony_ci              name: row.name,
1677fb726d48Sopenharmony_ci              id: row.rowId,
1678fb726d48Sopenharmony_ci            };
1679fb726d48Sopenharmony_ci          }),
1680fb726d48Sopenharmony_ci          scrollTop: this.rowsEL!.scrollTop,
1681fb726d48Sopenharmony_ci          favoriteScrollTop: this.favoriteChartListEL!.scrollTop,
1682fb726d48Sopenharmony_ci          //下载时存旗帜的信息
1683fb726d48Sopenharmony_ci          drawFlag: this.timerShaftEL!.sportRuler!.flagList,
1684fb726d48Sopenharmony_ci          //下载时存M和shiftM的信息
1685fb726d48Sopenharmony_ci          markFlag: this.timerShaftEL!.sportRuler!.slicesTimeList,
1686fb726d48Sopenharmony_ci        });
1687fb726d48Sopenharmony_ci        this.downloadRecordFile(data).then(() => { });
1688fb726d48Sopenharmony_ci      }
1689fb726d48Sopenharmony_ci    });
1690fb726d48Sopenharmony_ci  }
1691fb726d48Sopenharmony_ci
1692fb726d48Sopenharmony_ci  private async downloadRecordFile(jsonStr: string): Promise<void> {
1693fb726d48Sopenharmony_ci    let a = document.createElement('a');
1694fb726d48Sopenharmony_ci    let buffer = await readTraceFileBuffer();
1695fb726d48Sopenharmony_ci    if (buffer) {
1696fb726d48Sopenharmony_ci      let str = `MarkPositionJSON->${jsonStr}\n`;
1697fb726d48Sopenharmony_ci      let mark = new Blob([str]);
1698fb726d48Sopenharmony_ci      let markBuf = await mark.arrayBuffer();
1699fb726d48Sopenharmony_ci      a.href = URL.createObjectURL(new Blob([`${markBuf.byteLength}`, mark, buffer])); // @ts-ignore
1700fb726d48Sopenharmony_ci      a.download = (window as unknown).traceFileName || `${new Date().getTime()}`;
1701fb726d48Sopenharmony_ci      a.click();
1702fb726d48Sopenharmony_ci    }
1703fb726d48Sopenharmony_ci    window.publish(window.SmartEvent.UI.Loading, { loading: false, text: 'Downloading trace file with mark' });
1704fb726d48Sopenharmony_ci  }
1705fb726d48Sopenharmony_ci
1706fb726d48Sopenharmony_ci  private subRecordImportListener(): void {
1707fb726d48Sopenharmony_ci    //@ts-ignore
1708fb726d48Sopenharmony_ci    window.subscribe(window.SmartEvent.UI.ImportRecord, (data: string) => {
1709fb726d48Sopenharmony_ci      let record = JSON.parse(data);
1710fb726d48Sopenharmony_ci      if (record.leftNS !== undefined && record.rightNS !== undefined) {
1711fb726d48Sopenharmony_ci        this.favoriteChartListEL?.removeAllCollectRow();
1712fb726d48Sopenharmony_ci        let currentGroup = this.currentCollectGroup;
1713fb726d48Sopenharmony_ci        if (record.G1) {
1714fb726d48Sopenharmony_ci          this.currentCollectGroup = '1';
1715fb726d48Sopenharmony_ci          this.restoreRecordCollectRows(record.G1);
1716fb726d48Sopenharmony_ci        }
1717fb726d48Sopenharmony_ci        if (record.G2) {
1718fb726d48Sopenharmony_ci          this.currentCollectGroup = '2';
1719fb726d48Sopenharmony_ci          this.restoreRecordCollectRows(record.G2);
1720fb726d48Sopenharmony_ci        }
1721fb726d48Sopenharmony_ci        this.restoreRecordExpandAndTimeRange(record);
1722fb726d48Sopenharmony_ci        this.currentCollectGroup = currentGroup;
1723fb726d48Sopenharmony_ci        if (record.drawFlag !== undefined) {
1724fb726d48Sopenharmony_ci          this.timerShaftEL!.sportRuler!.flagList = record.drawFlag;//获取下载时存的旗帜信息
1725fb726d48Sopenharmony_ci          this.selectFlag = this.timerShaftEL!.sportRuler!.flagList.find((it) => it.selected);//绘制被选中旗帜对应的线
1726fb726d48Sopenharmony_ci        }
1727fb726d48Sopenharmony_ci        if (record.markFlag !== undefined) {
1728fb726d48Sopenharmony_ci          this.timerShaftEL!.sportRuler!.slicesTimeList = record.markFlag;//获取下载时存的M键信息
1729fb726d48Sopenharmony_ci        }
1730fb726d48Sopenharmony_ci        TraceRow.range!.refresh = true;
1731fb726d48Sopenharmony_ci        this.refreshCanvas(true);
1732fb726d48Sopenharmony_ci        this.restoreRecordScrollTop(record.scrollTop, record.favoriteScrollTop);
1733fb726d48Sopenharmony_ci      }
1734fb726d48Sopenharmony_ci    });
1735fb726d48Sopenharmony_ci  }
1736fb726d48Sopenharmony_ci
1737fb726d48Sopenharmony_ci  private restoreRecordExpandAndTimeRange(record: unknown): void {
1738fb726d48Sopenharmony_ci    // @ts-ignore
1739fb726d48Sopenharmony_ci    if (record.expand) {
1740fb726d48Sopenharmony_ci      let expandRows = // @ts-ignore
1741fb726d48Sopenharmony_ci        Array.from(this.rowsEL!.querySelectorAll<TraceRow<unknown>>('trace-row[folder][expansion]')) || [];
1742fb726d48Sopenharmony_ci      // @ts-ignore
1743fb726d48Sopenharmony_ci      let expands: Array<unknown> = record.expand;
1744fb726d48Sopenharmony_ci      //关闭不在记录中的父泳道
1745fb726d48Sopenharmony_ci      for (let expandRow of expandRows) {
1746fb726d48Sopenharmony_ci        if (
1747fb726d48Sopenharmony_ci          !expands.includes(
1748fb726d48Sopenharmony_ci            (it: unknown) =>
1749fb726d48Sopenharmony_ci              // @ts-ignore
1750fb726d48Sopenharmony_ci              it.id === expandRow.rowId && it.name === expandRow.name && it.type === expandRow.rowType
1751fb726d48Sopenharmony_ci          )
1752fb726d48Sopenharmony_ci        ) {
1753fb726d48Sopenharmony_ci          expandRow.expansion = false;
1754fb726d48Sopenharmony_ci        }
1755fb726d48Sopenharmony_ci      }
1756fb726d48Sopenharmony_ci      //展开记录的泳道
1757fb726d48Sopenharmony_ci      // @ts-ignore
1758fb726d48Sopenharmony_ci      for (let it of record.expand) {
1759fb726d48Sopenharmony_ci        // @ts-ignore
1760fb726d48Sopenharmony_ci        let traceRow = this.rowsEL!.querySelector<TraceRow<unknown>>(
1761fb726d48Sopenharmony_ci          `trace-row[folder][row-id='${it.id}'][row-type='${it.type}']`
1762fb726d48Sopenharmony_ci        );
1763fb726d48Sopenharmony_ci        if (traceRow && !traceRow.expansion) {
1764fb726d48Sopenharmony_ci          traceRow.expansion = true;
1765fb726d48Sopenharmony_ci        }
1766fb726d48Sopenharmony_ci      }
1767fb726d48Sopenharmony_ci    }
1768fb726d48Sopenharmony_ci    // @ts-ignore
1769fb726d48Sopenharmony_ci    this.timerShaftEL?.setRangeNS(record.leftNS, record.rightNS);
1770fb726d48Sopenharmony_ci  }
1771fb726d48Sopenharmony_ci
1772fb726d48Sopenharmony_ci  private restoreRecordScrollTop(mainScrollTop: number, favoriteScrollTop: number): void {
1773fb726d48Sopenharmony_ci    if (mainScrollTop && mainScrollTop > 0) {
1774fb726d48Sopenharmony_ci      this.rowsPaneEL!.scroll({
1775fb726d48Sopenharmony_ci        top: mainScrollTop,
1776fb726d48Sopenharmony_ci        left: 0,
1777fb726d48Sopenharmony_ci        behavior: 'smooth',
1778fb726d48Sopenharmony_ci      });
1779fb726d48Sopenharmony_ci    }
1780fb726d48Sopenharmony_ci    if (favoriteScrollTop && favoriteScrollTop > 0) {
1781fb726d48Sopenharmony_ci      this.favoriteChartListEL?.scroll({
1782fb726d48Sopenharmony_ci        top: favoriteScrollTop,
1783fb726d48Sopenharmony_ci        left: 0,
1784fb726d48Sopenharmony_ci        behavior: 'smooth',
1785fb726d48Sopenharmony_ci      });
1786fb726d48Sopenharmony_ci    }
1787fb726d48Sopenharmony_ci  }
1788fb726d48Sopenharmony_ci
1789fb726d48Sopenharmony_ci  private restoreRecordCollectRows(group: Array<unknown>): void {
1790fb726d48Sopenharmony_ci    group.forEach((it: unknown) => {
1791fb726d48Sopenharmony_ci      // @ts-ignore
1792fb726d48Sopenharmony_ci      let traceRow: TraceRow<unknown> | undefined | null = this.rowsEL!.querySelector<TraceRow<unknown>>( // @ts-ignore
1793fb726d48Sopenharmony_ci        `trace-row[row-id='${it.id}'][row-type='${it.type}']`
1794fb726d48Sopenharmony_ci      );
1795fb726d48Sopenharmony_ci      if (traceRow === null || traceRow === undefined) {
1796fb726d48Sopenharmony_ci        // @ts-ignore
1797fb726d48Sopenharmony_ci        if (it.parents.length > 0) {
1798fb726d48Sopenharmony_ci          // @ts-ignore
1799fb726d48Sopenharmony_ci          let rootFolder = it.parents[0]; // @ts-ignore
1800fb726d48Sopenharmony_ci          let folderRow: TraceRow<unknown> | undefined | null = this.rowsEL!.querySelector<TraceRow<unknown>>(
1801fb726d48Sopenharmony_ci            `trace-row[row-id='${rootFolder.id}'][row-type='${rootFolder.type}']`
1802fb726d48Sopenharmony_ci          );
1803fb726d48Sopenharmony_ci          if (folderRow) {
1804fb726d48Sopenharmony_ci            if (!folderRow!.expansion) {
1805fb726d48Sopenharmony_ci              folderRow!.expansion = true;
1806fb726d48Sopenharmony_ci            } // @ts-ignore
1807fb726d48Sopenharmony_ci            for (let i = 1; i < it.parents.length; i++) {
1808fb726d48Sopenharmony_ci              folderRow = folderRow!.childrenList.find(
1809fb726d48Sopenharmony_ci                // @ts-ignore
1810fb726d48Sopenharmony_ci                (child) => child.rowId === it.parents[i].id && child.rowType === it.parents[i].type
1811fb726d48Sopenharmony_ci              );
1812fb726d48Sopenharmony_ci              if (!folderRow!.expansion) {
1813fb726d48Sopenharmony_ci                folderRow!.expansion = true;
1814fb726d48Sopenharmony_ci              }
1815fb726d48Sopenharmony_ci            }
1816fb726d48Sopenharmony_ci          }
1817fb726d48Sopenharmony_ci          if (folderRow) {
1818fb726d48Sopenharmony_ci            // @ts-ignore
1819fb726d48Sopenharmony_ci            traceRow = folderRow.childrenList.find((child) => child.rowId === it.id && child.rowType === it.type);
1820fb726d48Sopenharmony_ci          }
1821fb726d48Sopenharmony_ci        }
1822fb726d48Sopenharmony_ci      }
1823fb726d48Sopenharmony_ci      if (traceRow) {
1824fb726d48Sopenharmony_ci        traceRow.collectEL?.click();
1825fb726d48Sopenharmony_ci      }
1826fb726d48Sopenharmony_ci    });
1827fb726d48Sopenharmony_ci  }
1828fb726d48Sopenharmony_ci
1829fb726d48Sopenharmony_ci  private wheelListener(): void {
1830fb726d48Sopenharmony_ci    document.addEventListener(
1831fb726d48Sopenharmony_ci      'wheel',
1832fb726d48Sopenharmony_ci      (e): void => {
1833fb726d48Sopenharmony_ci        if (e.ctrlKey) {
1834fb726d48Sopenharmony_ci          if (e.deltaY > 0) {
1835fb726d48Sopenharmony_ci            e.preventDefault();
1836fb726d48Sopenharmony_ci            e.stopPropagation();
1837fb726d48Sopenharmony_ci            let eventS = new KeyboardEvent('keypress', {
1838fb726d48Sopenharmony_ci              key: 's',
1839fb726d48Sopenharmony_ci              code: '83',
1840fb726d48Sopenharmony_ci              keyCode: 83,
1841fb726d48Sopenharmony_ci            });
1842fb726d48Sopenharmony_ci            this.timerShaftEL!.documentOnKeyPress(eventS);
1843fb726d48Sopenharmony_ci            setTimeout(() => this.timerShaftEL!.documentOnKeyUp(eventS), 200);
1844fb726d48Sopenharmony_ci          }
1845fb726d48Sopenharmony_ci          if (e.deltaY < 0) {
1846fb726d48Sopenharmony_ci            e.preventDefault();
1847fb726d48Sopenharmony_ci            e.stopPropagation();
1848fb726d48Sopenharmony_ci            let eventW = new KeyboardEvent('keypress', {
1849fb726d48Sopenharmony_ci              key: 'w',
1850fb726d48Sopenharmony_ci              code: '87',
1851fb726d48Sopenharmony_ci              keyCode: 87,
1852fb726d48Sopenharmony_ci            });
1853fb726d48Sopenharmony_ci            this.timerShaftEL!.documentOnKeyPress(eventW);
1854fb726d48Sopenharmony_ci            setTimeout(() => this.timerShaftEL!.documentOnKeyUp(eventW), 200);
1855fb726d48Sopenharmony_ci          }
1856fb726d48Sopenharmony_ci        }
1857fb726d48Sopenharmony_ci      },
1858fb726d48Sopenharmony_ci      { passive: false }
1859fb726d48Sopenharmony_ci    );
1860fb726d48Sopenharmony_ci  }
1861fb726d48Sopenharmony_ci
1862fb726d48Sopenharmony_ci  connectedCallback(): void {
1863fb726d48Sopenharmony_ci    this.initPointToEvent();
1864fb726d48Sopenharmony_ci    this.eventListener();
1865fb726d48Sopenharmony_ci    this.subRecordExportListener();
1866fb726d48Sopenharmony_ci    this.subRecordImportListener();
1867fb726d48Sopenharmony_ci    /**
1868fb726d48Sopenharmony_ci     * 泳道图中添加ctrl+鼠标滚轮事件,对泳道图进行放大缩小。
1869fb726d48Sopenharmony_ci     * 鼠标滚轮事件转化为键盘事件,keyPress和keyUp两个事件需要配合使用,
1870fb726d48Sopenharmony_ci     * 否则泳道图会一直放大或一直缩小。
1871fb726d48Sopenharmony_ci     * setTimeout()函数中的时间参数可以控制鼠标滚轮的频率。
1872fb726d48Sopenharmony_ci     */
1873fb726d48Sopenharmony_ci    SpApplication.skinChange2 = (val: boolean): void => {
1874fb726d48Sopenharmony_ci      this.timerShaftEL?.render();
1875fb726d48Sopenharmony_ci    };
1876fb726d48Sopenharmony_ci    window.subscribe(window.SmartEvent.UI.UploadSOFile, (data): void => {
1877fb726d48Sopenharmony_ci      this.chartManager?.importSoFileUpdate().then(() => {
1878fb726d48Sopenharmony_ci        window.publish(window.SmartEvent.UI.Loading, { loading: false, text: 'Import So File' });
1879fb726d48Sopenharmony_ci        let updateCanvas = this.traceSheetEL?.updateRangeSelect();
1880fb726d48Sopenharmony_ci        if (updateCanvas) {
1881fb726d48Sopenharmony_ci          this.refreshCanvas(true);
1882fb726d48Sopenharmony_ci        }
1883fb726d48Sopenharmony_ci      });
1884fb726d48Sopenharmony_ci    });
1885fb726d48Sopenharmony_ci    window.subscribe(window.SmartEvent.UI.KeyPath, (data): void => {
1886fb726d48Sopenharmony_ci      this.invisibleRows.forEach((it) => (it.needRefresh = true));
1887fb726d48Sopenharmony_ci      this.visibleRows.forEach((it) => (it.needRefresh = true)); //@ts-ignore
1888fb726d48Sopenharmony_ci      if (data.length === 0) {
1889fb726d48Sopenharmony_ci        // clear
1890fb726d48Sopenharmony_ci        SpSystemTrace.keyPathList = [];
1891fb726d48Sopenharmony_ci        this.refreshCanvas(false);
1892fb726d48Sopenharmony_ci      } else {
1893fb726d48Sopenharmony_ci        // draw
1894fb726d48Sopenharmony_ci        //@ts-ignore
1895fb726d48Sopenharmony_ci        queryCpuKeyPathData(data).then((res): void => {
1896fb726d48Sopenharmony_ci          SpSystemTrace.keyPathList = res;
1897fb726d48Sopenharmony_ci          this.refreshCanvas(false);
1898fb726d48Sopenharmony_ci        });
1899fb726d48Sopenharmony_ci      }
1900fb726d48Sopenharmony_ci    });
1901fb726d48Sopenharmony_ci    window.subscribe(window.SmartEvent.UI.CheckALL, (data): void => {
1902fb726d48Sopenharmony_ci      //@ts-ignore
1903fb726d48Sopenharmony_ci      this.getCollectRows((row) => row.rowParentId === data.rowId).forEach((it) => {
1904fb726d48Sopenharmony_ci        //@ts-ignore
1905fb726d48Sopenharmony_ci        it.checkType = data.isCheck ? '2' : '0';
1906fb726d48Sopenharmony_ci      });
1907fb726d48Sopenharmony_ci    });
1908fb726d48Sopenharmony_ci    window.subscribe(window.SmartEvent.UI.HoverNull, () => this.hoverStructNull());
1909fb726d48Sopenharmony_ci    this.subscribeBottomTabVisibleEvent();
1910fb726d48Sopenharmony_ci  }
1911fb726d48Sopenharmony_ci
1912fb726d48Sopenharmony_ci  public scrollH: number = 0;
1913fb726d48Sopenharmony_ci
1914fb726d48Sopenharmony_ci  subscribeBottomTabVisibleEvent(): void {
1915fb726d48Sopenharmony_ci    //@ts-ignore
1916fb726d48Sopenharmony_ci    window.subscribe(window.SmartEvent.UI.ShowBottomTab, (data: { show: number; delta: number }): void => {
1917fb726d48Sopenharmony_ci      if (data.show === 1) {
1918fb726d48Sopenharmony_ci        //显示底部tab
1919fb726d48Sopenharmony_ci        this.scrollH = this.rowsEL!.scrollHeight;
1920fb726d48Sopenharmony_ci      } else {
1921fb726d48Sopenharmony_ci        // 底部 tab 为 最小化 或者隐藏 时候
1922fb726d48Sopenharmony_ci        if (this.rowsEL!.scrollHeight > this.scrollH) {
1923fb726d48Sopenharmony_ci          this.rowsEL!.scrollTop = this.rowsEL!.scrollTop - data.delta;
1924fb726d48Sopenharmony_ci        }
1925fb726d48Sopenharmony_ci      }
1926fb726d48Sopenharmony_ci    });
1927fb726d48Sopenharmony_ci  }
1928fb726d48Sopenharmony_ci  // @ts-ignore
1929fb726d48Sopenharmony_ci  favoriteAreaSearchHandler(row: TraceRow<unknown>): void {
1930fb726d48Sopenharmony_ci    if (this.timerShaftEL!.collecBtn!.hasAttribute('close')) {
1931fb726d48Sopenharmony_ci      this.timerShaftEL!.collecBtn!.removeAttribute('close');
1932fb726d48Sopenharmony_ci      this.favoriteChartListEL!.showCollectArea();
1933fb726d48Sopenharmony_ci    }
1934fb726d48Sopenharmony_ci    this.favoriteChartListEL?.expandSearchRowGroup(row);
1935fb726d48Sopenharmony_ci  }
1936fb726d48Sopenharmony_ci
1937fb726d48Sopenharmony_ci  scrollToProcess(rowId: string, rowParentId: string, rowType: string, smooth: boolean = true): void {
1938fb726d48Sopenharmony_ci    let id = Utils.getDistributedRowId(rowId);
1939fb726d48Sopenharmony_ci    let parentId = Utils.getDistributedRowId(rowParentId);
1940fb726d48Sopenharmony_ci    let traceRow = // @ts-ignore
1941fb726d48Sopenharmony_ci      this.rowsEL!.querySelector<TraceRow<unknown>>(`trace-row[row-id='${id}'][row-type='${rowType}']`) ||
1942fb726d48Sopenharmony_ci      this.favoriteChartListEL!.getCollectRow((row) => row.rowId === id && row.rowType === rowType);
1943fb726d48Sopenharmony_ci    if (traceRow?.collect) {
1944fb726d48Sopenharmony_ci      this.favoriteChartListEL!.scroll({
1945fb726d48Sopenharmony_ci        top:
1946fb726d48Sopenharmony_ci          (traceRow?.offsetTop || 0) -
1947fb726d48Sopenharmony_ci          this.favoriteChartListEL!.getCanvas()!.offsetHeight +
1948fb726d48Sopenharmony_ci          (traceRow?.offsetHeight || 0),
1949fb726d48Sopenharmony_ci        left: 0,
1950fb726d48Sopenharmony_ci        behavior: smooth ? 'smooth' : undefined,
1951fb726d48Sopenharmony_ci      });
1952fb726d48Sopenharmony_ci    } else {
1953fb726d48Sopenharmony_ci      // @ts-ignore
1954fb726d48Sopenharmony_ci      let row = this.rowsEL!.querySelector<TraceRow<unknown>>(`trace-row[row-id='${parentId}'][folder]`);
1955fb726d48Sopenharmony_ci      if (row && !row.expansion) {
1956fb726d48Sopenharmony_ci        row.expansion = true;
1957fb726d48Sopenharmony_ci      }
1958fb726d48Sopenharmony_ci      if (traceRow && traceRow.offsetTop >= 0 && traceRow.offsetHeight >= 0) {
1959fb726d48Sopenharmony_ci        this.rowsPaneEL!.scroll({
1960fb726d48Sopenharmony_ci          top: (traceRow?.offsetTop || 0) - this.canvasPanel!.offsetHeight + (traceRow?.offsetHeight || 0),
1961fb726d48Sopenharmony_ci          left: 0,
1962fb726d48Sopenharmony_ci          behavior: smooth ? 'smooth' : undefined,
1963fb726d48Sopenharmony_ci        });
1964fb726d48Sopenharmony_ci      }
1965fb726d48Sopenharmony_ci    }
1966fb726d48Sopenharmony_ci  }
1967fb726d48Sopenharmony_ci
1968fb726d48Sopenharmony_ci  scrollToDepth(rowId: string, rowParentId: string, rowType: string, smooth: boolean = true, depth: number): void {
1969fb726d48Sopenharmony_ci    let rootRow = // @ts-ignore
1970fb726d48Sopenharmony_ci      this.rowsEL!.querySelector<TraceRow<unknown>>(`trace-row[row-id='${rowId}'][row-type='${rowType}']`) ||
1971fb726d48Sopenharmony_ci      this.favoriteChartListEL!.getCollectRow((row) => row.rowId === rowId && row.rowType === rowType);
1972fb726d48Sopenharmony_ci    if (rootRow && rootRow!.collect) {
1973fb726d48Sopenharmony_ci      this.favoriteAreaSearchHandler(rootRow);
1974fb726d48Sopenharmony_ci      rootRow.expandFunc(rootRow, this);
1975fb726d48Sopenharmony_ci      if (!this.isInViewport(rootRow)) {
1976fb726d48Sopenharmony_ci        setTimeout(() => {
1977fb726d48Sopenharmony_ci          rootRow!.scrollIntoView({ behavior: 'smooth' });
1978fb726d48Sopenharmony_ci        }, 500);
1979fb726d48Sopenharmony_ci      }
1980fb726d48Sopenharmony_ci    } else {
1981fb726d48Sopenharmony_ci      // @ts-ignore
1982fb726d48Sopenharmony_ci      let row = this.rowsEL!.querySelector<TraceRow<unknown>>(`trace-row[row-id='${rowParentId}'][folder]`);
1983fb726d48Sopenharmony_ci      if (row && !row.expansion) {
1984fb726d48Sopenharmony_ci        row.expansion = true;
1985fb726d48Sopenharmony_ci      }
1986fb726d48Sopenharmony_ci      if (rootRow) {
1987fb726d48Sopenharmony_ci        rootRow.expandFunc(rootRow, this);
1988fb726d48Sopenharmony_ci      }
1989fb726d48Sopenharmony_ci      setTimeout(() => {
1990fb726d48Sopenharmony_ci        rootRow!.scrollIntoView({ behavior: 'smooth', block: 'center' });
1991fb726d48Sopenharmony_ci      }, 500);
1992fb726d48Sopenharmony_ci    }
1993fb726d48Sopenharmony_ci  }
1994fb726d48Sopenharmony_ci
1995fb726d48Sopenharmony_ci  isInViewport(e: unknown): boolean {
1996fb726d48Sopenharmony_ci    // @ts-ignore
1997fb726d48Sopenharmony_ci    const rect = e.getBoundingClientRect();
1998fb726d48Sopenharmony_ci    return (
1999fb726d48Sopenharmony_ci      rect.top >= 0 &&
2000fb726d48Sopenharmony_ci      rect.left >= 0 &&
2001fb726d48Sopenharmony_ci      rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
2002fb726d48Sopenharmony_ci      rect.right <= (window.innerWidth || document.documentElement.clientWidth)
2003fb726d48Sopenharmony_ci    );
2004fb726d48Sopenharmony_ci  }
2005fb726d48Sopenharmony_ci
2006fb726d48Sopenharmony_ci  scrollToFunction(rowId: string, rowParentId: string, rowType: string, smooth: boolean = true): void {
2007fb726d48Sopenharmony_ci    let id = Utils.getDistributedRowId(rowId);
2008fb726d48Sopenharmony_ci    let parentId = Utils.getDistributedRowId(rowParentId);
2009fb726d48Sopenharmony_ci    let condition = `trace-row[row-id='${id}'][row-type='${rowType}'][row-parent-id='${parentId}']`;
2010fb726d48Sopenharmony_ci    let rootRow = // @ts-ignore
2011fb726d48Sopenharmony_ci      this.rowsEL!.querySelector<TraceRow<unknown>>(condition) ||
2012fb726d48Sopenharmony_ci      this.favoriteChartListEL!.getCollectRow((row) => {
2013fb726d48Sopenharmony_ci        return row.rowId === id && row.rowType === rowType && row.rowParentId === parentId;
2014fb726d48Sopenharmony_ci      });
2015fb726d48Sopenharmony_ci    if (rootRow?.collect) {
2016fb726d48Sopenharmony_ci      this.favoriteAreaSearchHandler(rootRow);
2017fb726d48Sopenharmony_ci      this.favoriteChartListEL!.scroll({
2018fb726d48Sopenharmony_ci        top:
2019fb726d48Sopenharmony_ci          (rootRow?.offsetTop || 0) -
2020fb726d48Sopenharmony_ci          this.favoriteChartListEL!.getCanvas()!.offsetHeight +
2021fb726d48Sopenharmony_ci          (rootRow?.offsetHeight || 0),
2022fb726d48Sopenharmony_ci        left: 0,
2023fb726d48Sopenharmony_ci        behavior: smooth ? 'smooth' : undefined,
2024fb726d48Sopenharmony_ci      });
2025fb726d48Sopenharmony_ci    } else {
2026fb726d48Sopenharmony_ci      // @ts-ignore
2027fb726d48Sopenharmony_ci      let row = this.rowsEL!.querySelector<TraceRow<unknown>>(`trace-row[row-id='${rowParentId}'][folder]`);
2028fb726d48Sopenharmony_ci      if (row && !row.expansion) {
2029fb726d48Sopenharmony_ci        row.expansion = true;
2030fb726d48Sopenharmony_ci      }
2031fb726d48Sopenharmony_ci      if (rootRow && rootRow.offsetTop >= 0 && rootRow.offsetHeight >= 0) {
2032fb726d48Sopenharmony_ci        this.rowsPaneEL!.scroll({
2033fb726d48Sopenharmony_ci          top: (rootRow?.offsetTop || 0) - this.canvasPanel!.offsetHeight + 20,
2034fb726d48Sopenharmony_ci          left: 0,
2035fb726d48Sopenharmony_ci          behavior: smooth ? 'smooth' : undefined,
2036fb726d48Sopenharmony_ci        });
2037fb726d48Sopenharmony_ci      }
2038fb726d48Sopenharmony_ci    }
2039fb726d48Sopenharmony_ci  }
2040fb726d48Sopenharmony_ci
2041fb726d48Sopenharmony_ci  disconnectedCallback(): void {
2042fb726d48Sopenharmony_ci    this.timerShaftEL?.removeEventListener('range-change', this.timerShaftELRangeChange);
2043fb726d48Sopenharmony_ci    this.rowsPaneEL?.removeEventListener('scroll', this.rowsElOnScroll);
2044fb726d48Sopenharmony_ci    this.favoriteChartListEL?.removeEventListener('scroll', this.favoriteRowsElOnScroll);
2045fb726d48Sopenharmony_ci    this.removeEventListener('mousemove', this.documentOnMouseMove);
2046fb726d48Sopenharmony_ci    this.removeEventListener('click', this.documentOnClick);
2047fb726d48Sopenharmony_ci    this.removeEventListener('mousedown', this.documentOnMouseDown);
2048fb726d48Sopenharmony_ci    this.removeEventListener('mouseup', this.documentOnMouseUp);
2049fb726d48Sopenharmony_ci    this.removeEventListener('mouseout', this.documentOnMouseOut);
2050fb726d48Sopenharmony_ci    document.removeEventListener('keypress', this.documentOnKeyPress);
2051fb726d48Sopenharmony_ci    document.removeEventListener('keydown', this.documentOnKeyDown);
2052fb726d48Sopenharmony_ci    document.removeEventListener('keyup', this.documentOnKeyUp);
2053fb726d48Sopenharmony_ci    document.removeEventListener('contextmenu', this.onContextMenuHandler);
2054fb726d48Sopenharmony_ci    window.unsubscribe(window.SmartEvent.UI.SliceMark, this.sliceMarkEventHandler.bind(this));
2055fb726d48Sopenharmony_ci  }
2056fb726d48Sopenharmony_ci
2057fb726d48Sopenharmony_ci  sliceMarkEventHandler(ev: unknown): void {
2058fb726d48Sopenharmony_ci    SpSystemTrace.sliceRangeMark = ev; // @ts-ignore
2059fb726d48Sopenharmony_ci    let startNS = ev.timestamp - (window as unknown).recordStartNS; // @ts-ignore
2060fb726d48Sopenharmony_ci    let endNS = ev.maxDuration + startNS;
2061fb726d48Sopenharmony_ci    TraceRow.rangeSelectObject = {
2062fb726d48Sopenharmony_ci      startX: 0,
2063fb726d48Sopenharmony_ci      startNS: startNS,
2064fb726d48Sopenharmony_ci      endNS: endNS,
2065fb726d48Sopenharmony_ci      endX: 0,
2066fb726d48Sopenharmony_ci    };
2067fb726d48Sopenharmony_ci    window.publish(window.SmartEvent.UI.MenuTrace, {});
2068fb726d48Sopenharmony_ci    window.publish(window.SmartEvent.UI.TimeRange, {
2069fb726d48Sopenharmony_ci      // @ts-ignore
2070fb726d48Sopenharmony_ci      startNS: startNS - ev.maxDuration, // @ts-ignore
2071fb726d48Sopenharmony_ci      endNS: endNS + ev.maxDuration,
2072fb726d48Sopenharmony_ci    });
2073fb726d48Sopenharmony_ci    this.queryAllTraceRow().forEach((it) => (it.checkType = '-1'));
2074fb726d48Sopenharmony_ci    this.rangeSelect.rangeTraceRow = [];
2075fb726d48Sopenharmony_ci    this.selectStructNull();
2076fb726d48Sopenharmony_ci    this.wakeupListNull();
2077fb726d48Sopenharmony_ci    this.traceSheetEL?.setMode('hidden');
2078fb726d48Sopenharmony_ci    this.removeLinkLinesByBusinessType('janks');
2079fb726d48Sopenharmony_ci    this.removeLinkLinesByBusinessType('distributed');
2080fb726d48Sopenharmony_ci    TraceRow.range!.refresh = true;
2081fb726d48Sopenharmony_ci    this.refreshCanvas(false, 'slice mark event');
2082fb726d48Sopenharmony_ci  }
2083fb726d48Sopenharmony_ci
2084fb726d48Sopenharmony_ci  loadDatabaseUrl(
2085fb726d48Sopenharmony_ci    url: string,
2086fb726d48Sopenharmony_ci    progress: Function,
2087fb726d48Sopenharmony_ci    complete?: ((res: { status: boolean; msg: string }) => void) | undefined
2088fb726d48Sopenharmony_ci  ): void {
2089fb726d48Sopenharmony_ci    this.observerScrollHeightEnable = false;
2090fb726d48Sopenharmony_ci    this.init({ url: url }, '', progress, false).then((res) => {
2091fb726d48Sopenharmony_ci      if (complete) {
2092fb726d48Sopenharmony_ci        // @ts-ignore
2093fb726d48Sopenharmony_ci        complete(res);
2094fb726d48Sopenharmony_ci        window.publish(window.SmartEvent.UI.MouseEventEnable, {
2095fb726d48Sopenharmony_ci          mouseEnable: true,
2096fb726d48Sopenharmony_ci        });
2097fb726d48Sopenharmony_ci      }
2098fb726d48Sopenharmony_ci    });
2099fb726d48Sopenharmony_ci  }
2100fb726d48Sopenharmony_ci
2101fb726d48Sopenharmony_ci  loadDatabaseArrayBuffer(
2102fb726d48Sopenharmony_ci    buf: ArrayBuffer,
2103fb726d48Sopenharmony_ci    thirdPartyWasmConfigUrl: string,
2104fb726d48Sopenharmony_ci    progress: (name: string, percent: number) => void,
2105fb726d48Sopenharmony_ci    isDistributed: boolean,
2106fb726d48Sopenharmony_ci    complete?: ((res: { status: boolean; msg: string }) => void) | undefined,
2107fb726d48Sopenharmony_ci    buf2?: ArrayBuffer,
2108fb726d48Sopenharmony_ci    fileName1?: string,
2109fb726d48Sopenharmony_ci    fileName2?: string
2110fb726d48Sopenharmony_ci  ): void {
2111fb726d48Sopenharmony_ci    this.observerScrollHeightEnable = false;
2112fb726d48Sopenharmony_ci    if (isDistributed) {
2113fb726d48Sopenharmony_ci      this.timerShaftEL?.setAttribute('distributed', '');
2114fb726d48Sopenharmony_ci    } else {
2115fb726d48Sopenharmony_ci      this.timerShaftEL?.removeAttribute('distributed');
2116fb726d48Sopenharmony_ci    }
2117fb726d48Sopenharmony_ci    this.init({ buf, buf2, fileName1, fileName2 }, thirdPartyWasmConfigUrl, progress, isDistributed).then((res) => {
2118fb726d48Sopenharmony_ci      // @ts-ignore
2119fb726d48Sopenharmony_ci      this.rowsEL?.querySelectorAll('trace-row').forEach((it: unknown) => this.observer.observe(it));
2120fb726d48Sopenharmony_ci      if (complete) {
2121fb726d48Sopenharmony_ci        // @ts-ignore
2122fb726d48Sopenharmony_ci        complete(res);
2123fb726d48Sopenharmony_ci        window.publish(window.SmartEvent.UI.MouseEventEnable, {
2124fb726d48Sopenharmony_ci          mouseEnable: true,
2125fb726d48Sopenharmony_ci        });
2126fb726d48Sopenharmony_ci      }
2127fb726d48Sopenharmony_ci    });
2128fb726d48Sopenharmony_ci  }
2129fb726d48Sopenharmony_ci
2130fb726d48Sopenharmony_ci  loadSample = async (ev: File): Promise<void> => {
2131fb726d48Sopenharmony_ci    this.observerScrollHeightEnable = false;
2132fb726d48Sopenharmony_ci    await this.initSample(ev); // @ts-ignore
2133fb726d48Sopenharmony_ci    this.rowsEL?.querySelectorAll('trace-row').forEach((it: unknown) => this.observer.observe(it));
2134fb726d48Sopenharmony_ci    window.publish(window.SmartEvent.UI.MouseEventEnable, {
2135fb726d48Sopenharmony_ci      mouseEnable: true,
2136fb726d48Sopenharmony_ci    });
2137fb726d48Sopenharmony_ci  };
2138fb726d48Sopenharmony_ci
2139fb726d48Sopenharmony_ci  initSample = async (ev: File): Promise<void> => {
2140fb726d48Sopenharmony_ci    this.rowsPaneEL!.scroll({
2141fb726d48Sopenharmony_ci      top: 0,
2142fb726d48Sopenharmony_ci      left: 0,
2143fb726d48Sopenharmony_ci    });
2144fb726d48Sopenharmony_ci    this.chartManager?.initSample(ev).then((): void => {
2145fb726d48Sopenharmony_ci      this.loadTraceCompleted = true; // @ts-ignore
2146fb726d48Sopenharmony_ci      this.rowsEL!.querySelectorAll<TraceRow<unknown>>('trace-row').forEach((it): void => {
2147fb726d48Sopenharmony_ci        this.intersectionObserver?.observe(it);
2148fb726d48Sopenharmony_ci      });
2149fb726d48Sopenharmony_ci    });
2150fb726d48Sopenharmony_ci  };
2151fb726d48Sopenharmony_ci
2152fb726d48Sopenharmony_ci  loadGpuCounter = async (ev: File): Promise<void> => {
2153fb726d48Sopenharmony_ci    this.observerScrollHeightEnable = false;
2154fb726d48Sopenharmony_ci    await this.initGpuCounter(ev);
2155fb726d48Sopenharmony_ci    // @ts-ignore
2156fb726d48Sopenharmony_ci    this.rowsEL?.querySelectorAll('trace-row').forEach((it: unknown) => this.observer.observe(it));
2157fb726d48Sopenharmony_ci    window.publish(window.SmartEvent.UI.MouseEventEnable, {
2158fb726d48Sopenharmony_ci      mouseEnable: true,
2159fb726d48Sopenharmony_ci    });
2160fb726d48Sopenharmony_ci  };
2161fb726d48Sopenharmony_ci
2162fb726d48Sopenharmony_ci  initGpuCounter = async (ev: File): Promise<void> => {
2163fb726d48Sopenharmony_ci    this.rowsPaneEL!.scroll({
2164fb726d48Sopenharmony_ci      top: 0,
2165fb726d48Sopenharmony_ci      left: 0,
2166fb726d48Sopenharmony_ci    });
2167fb726d48Sopenharmony_ci    this.chartManager?.initGpuCounter(ev).then(() => {
2168fb726d48Sopenharmony_ci      this.loadTraceCompleted = true;
2169fb726d48Sopenharmony_ci      // @ts-ignore
2170fb726d48Sopenharmony_ci      this.rowsEL!.querySelectorAll<TraceRow<unknown>>('trace-row').forEach((it) => {
2171fb726d48Sopenharmony_ci        this.intersectionObserver?.observe(it);
2172fb726d48Sopenharmony_ci      });
2173fb726d48Sopenharmony_ci    });
2174fb726d48Sopenharmony_ci  };
2175fb726d48Sopenharmony_ci
2176fb726d48Sopenharmony_ci  // @ts-ignore
2177fb726d48Sopenharmony_ci  queryAllTraceRow<T>(selectors?: string, filter?: (row: TraceRow<unknown>) => boolean): TraceRow<unknown>[] {
2178fb726d48Sopenharmony_ci    return [
2179fb726d48Sopenharmony_ci      // @ts-ignore
2180fb726d48Sopenharmony_ci      ...this.rowsEL!.querySelectorAll<TraceRow<unknown>>(selectors ?? 'trace-row'),
2181fb726d48Sopenharmony_ci      ...this.favoriteChartListEL!.getCollectRows(filter),
2182fb726d48Sopenharmony_ci    ];
2183fb726d48Sopenharmony_ci  }
2184fb726d48Sopenharmony_ci
2185fb726d48Sopenharmony_ci  search(query: string): void {
2186fb726d48Sopenharmony_ci    this.queryAllTraceRow().forEach((item): void => {
2187fb726d48Sopenharmony_ci      if (query === null || query === undefined || query === '') {
2188fb726d48Sopenharmony_ci        if (
2189fb726d48Sopenharmony_ci          item.rowType === TraceRow.ROW_TYPE_CPU ||
2190fb726d48Sopenharmony_ci          item.rowType === TraceRow.ROW_TYPE_CPU_FREQ ||
2191fb726d48Sopenharmony_ci          item.rowType === TraceRow.ROW_TYPE_NATIVE_MEMORY ||
2192fb726d48Sopenharmony_ci          item.rowType === TraceRow.ROW_TYPE_FPS ||
2193fb726d48Sopenharmony_ci          item.rowType === TraceRow.ROW_TYPE_PROCESS ||
2194fb726d48Sopenharmony_ci          item.rowType === TraceRow.ROW_TYPE_CPU_ABILITY ||
2195fb726d48Sopenharmony_ci          item.rowType === TraceRow.ROW_TYPE_MEMORY_ABILITY ||
2196fb726d48Sopenharmony_ci          item.rowType === TraceRow.ROW_TYPE_DISK_ABILITY ||
2197fb726d48Sopenharmony_ci          item.rowType === TraceRow.ROW_TYPE_NETWORK_ABILITY
2198fb726d48Sopenharmony_ci        ) {
2199fb726d48Sopenharmony_ci          item.expansion = false;
2200fb726d48Sopenharmony_ci          item.rowHidden = false;
2201fb726d48Sopenharmony_ci        } else {
2202fb726d48Sopenharmony_ci          item.rowHidden = true;
2203fb726d48Sopenharmony_ci        }
2204fb726d48Sopenharmony_ci      } else {
2205fb726d48Sopenharmony_ci        item.rowHidden = item.name.toLowerCase().indexOf(query.toLowerCase()) < 0;
2206fb726d48Sopenharmony_ci      }
2207fb726d48Sopenharmony_ci    });
2208fb726d48Sopenharmony_ci    this.visibleRows.forEach((it) => (it.rowHidden = false && it.draw(true)));
2209fb726d48Sopenharmony_ci  }
2210fb726d48Sopenharmony_ci
2211fb726d48Sopenharmony_ci  async searchCPU(query: string): Promise<Array<unknown>> {
2212fb726d48Sopenharmony_ci    let pidArr: Array<number> = [];
2213fb726d48Sopenharmony_ci    let tidArr: Array<number> = [];
2214fb726d48Sopenharmony_ci    let processMap = Utils.getInstance().getProcessMap(Utils.currentSelectTrace);
2215fb726d48Sopenharmony_ci    let threadMap = Utils.getInstance().getThreadMap(Utils.currentSelectTrace);
2216fb726d48Sopenharmony_ci    for (let key of processMap.keys()) {
2217fb726d48Sopenharmony_ci      if (`${key}`.includes(query) || (processMap.get(key) || '').includes(query)) {
2218fb726d48Sopenharmony_ci        pidArr.push(key);
2219fb726d48Sopenharmony_ci      }
2220fb726d48Sopenharmony_ci    }
2221fb726d48Sopenharmony_ci    for (let key of threadMap.keys()) {
2222fb726d48Sopenharmony_ci      if (`${key}`.includes(query) || (threadMap.get(key) || '').includes(query)) {
2223fb726d48Sopenharmony_ci        tidArr.push(key);
2224fb726d48Sopenharmony_ci      }
2225fb726d48Sopenharmony_ci    }
2226fb726d48Sopenharmony_ci    return await searchCpuDataSender(pidArr, tidArr, Utils.currentSelectTrace);
2227fb726d48Sopenharmony_ci  }
2228fb726d48Sopenharmony_ci  //根据seach的内容匹配异步缓存数据中那些符合条件
2229fb726d48Sopenharmony_ci  seachAsyncFunc(query: string): unknown[] {
2230fb726d48Sopenharmony_ci    let asyncFuncArr: Array<unknown> = [];
2231fb726d48Sopenharmony_ci    let strNew = (str: unknown): string => {
2232fb726d48Sopenharmony_ci      const specialChars = {
2233fb726d48Sopenharmony_ci        '': '\\^',
2234fb726d48Sopenharmony_ci        '$': '\\$',
2235fb726d48Sopenharmony_ci        '.': '\\.',
2236fb726d48Sopenharmony_ci        '*': '\\*',
2237fb726d48Sopenharmony_ci        '+': '\\+',
2238fb726d48Sopenharmony_ci        '?': '\\?',
2239fb726d48Sopenharmony_ci        '-': '\\-',
2240fb726d48Sopenharmony_ci        '|': '\\|',
2241fb726d48Sopenharmony_ci        '(': '\\(',
2242fb726d48Sopenharmony_ci        ')': '\\)',
2243fb726d48Sopenharmony_ci        '[': '\\[',
2244fb726d48Sopenharmony_ci        ']': '\\]',
2245fb726d48Sopenharmony_ci        '{': '\\{',
2246fb726d48Sopenharmony_ci        '}': '\\}',
2247fb726d48Sopenharmony_ci      };
2248fb726d48Sopenharmony_ci      // @ts-ignore
2249fb726d48Sopenharmony_ci      return str.replace(/[$\^.*+?|()\[\]{}-]/g, (match: string) => specialChars[match as keyof typeof specialChars]); // 类型断言
2250fb726d48Sopenharmony_ci    };
2251fb726d48Sopenharmony_ci    let regex = new RegExp(strNew(query), 'i');
2252fb726d48Sopenharmony_ci    SpProcessChart.asyncFuncCache.forEach((item: unknown) => {
2253fb726d48Sopenharmony_ci      // @ts-ignore
2254fb726d48Sopenharmony_ci      if (regex.test(item.funName)) {
2255fb726d48Sopenharmony_ci        asyncFuncArr.push(item);
2256fb726d48Sopenharmony_ci      }
2257fb726d48Sopenharmony_ci    });
2258fb726d48Sopenharmony_ci    return asyncFuncArr;
2259fb726d48Sopenharmony_ci  }
2260fb726d48Sopenharmony_ci
2261fb726d48Sopenharmony_ci  async searchFunction(cpuList: Array<unknown>, asynList: Array<unknown>, query: string): Promise<Array<unknown>> {
2262fb726d48Sopenharmony_ci    let processList: Array<string> = [];
2263fb726d48Sopenharmony_ci    let traceRow = // @ts-ignore
2264fb726d48Sopenharmony_ci      this.shadowRoot!.querySelector<TraceRow<unknown>>('trace-row[scene]') ||
2265fb726d48Sopenharmony_ci      this.favoriteChartListEL!.getCollectRow((row) => row.hasAttribute('scene'));
2266fb726d48Sopenharmony_ci    if (traceRow) {
2267fb726d48Sopenharmony_ci      // @ts-ignore
2268fb726d48Sopenharmony_ci      this.shadowRoot!.querySelectorAll<TraceRow<unknown>>("trace-row[row-type='process'][scene]").forEach(
2269fb726d48Sopenharmony_ci        (row): void => {
2270fb726d48Sopenharmony_ci          let rowId = row.rowId;
2271fb726d48Sopenharmony_ci          if (rowId && rowId.includes('-')) {
2272fb726d48Sopenharmony_ci            rowId = rowId.split('-')[0];
2273fb726d48Sopenharmony_ci          }
2274fb726d48Sopenharmony_ci          processList.push(rowId as string);
2275fb726d48Sopenharmony_ci        }
2276fb726d48Sopenharmony_ci      );
2277fb726d48Sopenharmony_ci      if (query.includes('_')) {
2278fb726d48Sopenharmony_ci        query = query.replace(/_/g, '\\_');
2279fb726d48Sopenharmony_ci      }
2280fb726d48Sopenharmony_ci      if (query.includes('%')) {
2281fb726d48Sopenharmony_ci        query = query.replace(/%/g, '\\%');
2282fb726d48Sopenharmony_ci      }
2283fb726d48Sopenharmony_ci      let list = await querySceneSearchFunc(query, processList);
2284fb726d48Sopenharmony_ci      cpuList = cpuList.concat(asynList);
2285fb726d48Sopenharmony_ci      cpuList = cpuList.concat(list); // @ts-ignore
2286fb726d48Sopenharmony_ci      cpuList.sort((a, b) => (a.startTime || 0) - (b.startTime || 0));
2287fb726d48Sopenharmony_ci      return cpuList;
2288fb726d48Sopenharmony_ci    } else {
2289fb726d48Sopenharmony_ci      let list = await querySearchFunc(query);
2290fb726d48Sopenharmony_ci      cpuList = cpuList.concat(asynList);
2291fb726d48Sopenharmony_ci      cpuList = cpuList.concat(list); // @ts-ignore
2292fb726d48Sopenharmony_ci      cpuList.sort((a, b) => (a.startTime || 0) - (b.startTime || 0));
2293fb726d48Sopenharmony_ci      return cpuList;
2294fb726d48Sopenharmony_ci    }
2295fb726d48Sopenharmony_ci  }
2296fb726d48Sopenharmony_ci
2297fb726d48Sopenharmony_ci  searchTargetTraceHandler(): void {
2298fb726d48Sopenharmony_ci    if (Utils.currentSelectTrace) {
2299fb726d48Sopenharmony_ci      // @ts-ignore
2300fb726d48Sopenharmony_ci      let traceFolder1 = this.shadowRoot!.querySelector<TraceRow<unknown>>(`trace-row[row-id='trace-1']`);
2301fb726d48Sopenharmony_ci      // @ts-ignore
2302fb726d48Sopenharmony_ci      let traceFolder2 = this.shadowRoot!.querySelector<TraceRow<unknown>>(`trace-row[row-id='trace-2']`);
2303fb726d48Sopenharmony_ci      if (Utils.currentSelectTrace === '1') {
2304fb726d48Sopenharmony_ci        if (traceFolder2?.expansion) {
2305fb726d48Sopenharmony_ci          traceFolder2!.expansion = false;
2306fb726d48Sopenharmony_ci        }
2307fb726d48Sopenharmony_ci        traceFolder1!.expansion = true;
2308fb726d48Sopenharmony_ci      } else {
2309fb726d48Sopenharmony_ci        if (traceFolder1?.expansion) {
2310fb726d48Sopenharmony_ci          traceFolder1!.expansion = false;
2311fb726d48Sopenharmony_ci        }
2312fb726d48Sopenharmony_ci        traceFolder2!.expansion = true;
2313fb726d48Sopenharmony_ci      }
2314fb726d48Sopenharmony_ci    }
2315fb726d48Sopenharmony_ci  }
2316fb726d48Sopenharmony_ci
2317fb726d48Sopenharmony_ci  searchSdk(dataList: Array<unknown>, query: string): Array<unknown> {
2318fb726d48Sopenharmony_ci    let traceRow = // @ts-ignore
2319fb726d48Sopenharmony_ci      this.shadowRoot!.querySelector<TraceRow<unknown>>('trace-row[scene]') ||
2320fb726d48Sopenharmony_ci      this.favoriteChartListEL!.getCollectRow((row) => row.hasAttribute('scene'));
2321fb726d48Sopenharmony_ci    let dataAll = "trace-row[row-type^='sdk']";
2322fb726d48Sopenharmony_ci    if (traceRow) {
2323fb726d48Sopenharmony_ci      dataAll = "trace-row[row-type^='sdk'][scene]";
2324fb726d48Sopenharmony_ci    }
2325fb726d48Sopenharmony_ci    let allTraceRow: unknown = []; // @ts-ignore
2326fb726d48Sopenharmony_ci    let parentRows = this.shadowRoot!.querySelectorAll<TraceRow<unknown>>(`${dataAll}`); // @ts-ignore
2327fb726d48Sopenharmony_ci    parentRows.forEach((parentRow: TraceRow<unknown>): void => {
2328fb726d48Sopenharmony_ci      // @ts-ignore
2329fb726d48Sopenharmony_ci      allTraceRow.push(parentRow);
2330fb726d48Sopenharmony_ci      if (parentRow.childrenList && parentRow.childrenList.length > 0) {
2331fb726d48Sopenharmony_ci        // @ts-ignore
2332fb726d48Sopenharmony_ci        allTraceRow.push(...parentRow.childrenList);
2333fb726d48Sopenharmony_ci      }
2334fb726d48Sopenharmony_ci    }); // @ts-ignore
2335fb726d48Sopenharmony_ci    allTraceRow.forEach((row: unknown): void => {
2336fb726d48Sopenharmony_ci      // @ts-ignore
2337fb726d48Sopenharmony_ci      if (row!.name.indexOf(query) >= 0) {
2338fb726d48Sopenharmony_ci        let searchSdkBean = new SearchSdkBean();
2339fb726d48Sopenharmony_ci        searchSdkBean.startTime = TraceRow.range!.startNS;
2340fb726d48Sopenharmony_ci        searchSdkBean.dur = TraceRow.range!.totalNS; // @ts-ignore
2341fb726d48Sopenharmony_ci        searchSdkBean.name = row.name; // @ts-ignore
2342fb726d48Sopenharmony_ci        searchSdkBean.rowId = row.rowId;
2343fb726d48Sopenharmony_ci        searchSdkBean.type = 'sdk'; // @ts-ignore
2344fb726d48Sopenharmony_ci        searchSdkBean.rowType = row.rowType; // @ts-ignore
2345fb726d48Sopenharmony_ci        searchSdkBean.rowParentId = row.rowParentId;
2346fb726d48Sopenharmony_ci        dataList.push(searchSdkBean);
2347fb726d48Sopenharmony_ci      }
2348fb726d48Sopenharmony_ci    });
2349fb726d48Sopenharmony_ci    return dataList;
2350fb726d48Sopenharmony_ci  }
2351fb726d48Sopenharmony_ci
2352fb726d48Sopenharmony_ci  showStruct(previous: boolean, currentIndex: number, structs: Array<unknown>, retargetIndex?: number): number {
2353fb726d48Sopenharmony_ci    let tagIndex = spSystemTraceShowStruct(this, previous, currentIndex, structs, retargetIndex);
2354fb726d48Sopenharmony_ci    return tagIndex === -1 ? currentIndex : tagIndex;
2355fb726d48Sopenharmony_ci  }
2356fb726d48Sopenharmony_ci
2357fb726d48Sopenharmony_ci  private toTargetDepth = (entry: unknown, funcRowID: string, funcStract: unknown): void => {
2358fb726d48Sopenharmony_ci    if (entry) {
2359fb726d48Sopenharmony_ci      this.hoverStructNull();
2360fb726d48Sopenharmony_ci      this.selectStructNull();
2361fb726d48Sopenharmony_ci      this.wakeupListNull();
2362fb726d48Sopenharmony_ci      // @ts-ignore
2363fb726d48Sopenharmony_ci      FuncStruct.hoverFuncStruct = entry; // @ts-ignore
2364fb726d48Sopenharmony_ci      FuncStruct.selectFuncStruct = entry;
2365fb726d48Sopenharmony_ci      this.scrollToDepth(
2366fb726d48Sopenharmony_ci        `${funcRowID}`, // @ts-ignore
2367fb726d48Sopenharmony_ci        `${Utils.getDistributedRowId(funcStract.pid)}`,
2368fb726d48Sopenharmony_ci        'func',
2369fb726d48Sopenharmony_ci        true, // @ts-ignore
2370fb726d48Sopenharmony_ci        entry.depth || 0
2371fb726d48Sopenharmony_ci      );
2372fb726d48Sopenharmony_ci      // 鼠标左键点击不需要触发点击事件
2373fb726d48Sopenharmony_ci      if (FuncStruct.funcSelect) {
2374fb726d48Sopenharmony_ci        this.onClickHandler(TraceRow.ROW_TYPE_FUNC, undefined, entry);
2375fb726d48Sopenharmony_ci      } // @ts-ignore
2376fb726d48Sopenharmony_ci      FuncStruct.funcSelect = true;
2377fb726d48Sopenharmony_ci    }
2378fb726d48Sopenharmony_ci  };
2379fb726d48Sopenharmony_ci
2380fb726d48Sopenharmony_ci  scrollToActFunc(funcStract: unknown, highlight: boolean): void {
2381fb726d48Sopenharmony_ci    if (!Utils.isBinder(funcStract)) {
2382fb726d48Sopenharmony_ci      // @ts-ignore
2383fb726d48Sopenharmony_ci      if (funcStract.dur === -1 || funcStract.dur === null || funcStract.dur === undefined) {
2384fb726d48Sopenharmony_ci        // @ts-ignore
2385fb726d48Sopenharmony_ci        funcStract.dur = (TraceRow.range?.totalNS || 0) - (funcStract.startTs || 0); // @ts-ignore
2386fb726d48Sopenharmony_ci        funcStract.flag = 'Did not end';
2387fb726d48Sopenharmony_ci      }
2388fb726d48Sopenharmony_ci    }
2389fb726d48Sopenharmony_ci    //@ts-ignore
2390fb726d48Sopenharmony_ci    let funId = funcStract.row_id === null ? `${funcStract.funName}-${funcStract.pid}` : funcStract.row_id;
2391fb726d48Sopenharmony_ci    //@ts-ignore
2392fb726d48Sopenharmony_ci    let funcRowID = (funcStract.cookie === null || funcStract.cookie === undefined) ? `${Utils.getDistributedRowId(funcStract.tid)}` : funId;
2393fb726d48Sopenharmony_ci    let targetRow = this.favoriteChartListEL?.getCollectRow((row) => {
2394fb726d48Sopenharmony_ci      return row.rowId === funcRowID && row.rowType === 'func';
2395fb726d48Sopenharmony_ci    });
2396fb726d48Sopenharmony_ci    if (targetRow) {
2397fb726d48Sopenharmony_ci      targetRow.fixedList[0] = funcStract;
2398fb726d48Sopenharmony_ci      targetRow.highlight = highlight;
2399fb726d48Sopenharmony_ci      //如果目标泳道图在收藏上面,则跳转至收藏
2400fb726d48Sopenharmony_ci      this.toTargetDepth(funcStract, funcRowID, funcStract);
2401fb726d48Sopenharmony_ci      return;
2402fb726d48Sopenharmony_ci    }
2403fb726d48Sopenharmony_ci    let parentRow = this.rowsEL!.querySelector<TraceRow<BaseStruct>>(
2404fb726d48Sopenharmony_ci      // @ts-ignore
2405fb726d48Sopenharmony_ci      `trace-row[row-id='${Utils.getDistributedRowId(funcStract.pid)}'][folder]`
2406fb726d48Sopenharmony_ci    );
2407fb726d48Sopenharmony_ci    if (!parentRow) {
2408fb726d48Sopenharmony_ci      return;
2409fb726d48Sopenharmony_ci    }
2410fb726d48Sopenharmony_ci    let filterRow = parentRow.childrenList.filter((child) => child.rowId === funcRowID && child.rowType === 'func')[0];
2411fb726d48Sopenharmony_ci    if (!filterRow) {
2412fb726d48Sopenharmony_ci      // @ts-ignore
2413fb726d48Sopenharmony_ci      let funcRow = this.rowsEL?.querySelector<TraceRow<unknown>>(`trace-row[row-id='${funcRowID}'][row-type='func']`);
2414fb726d48Sopenharmony_ci      if (funcRow) {
2415fb726d48Sopenharmony_ci        filterRow = funcRow;
2416fb726d48Sopenharmony_ci      } else {
2417fb726d48Sopenharmony_ci        return;
2418fb726d48Sopenharmony_ci      }
2419fb726d48Sopenharmony_ci    }
2420fb726d48Sopenharmony_ci    filterRow.fixedList = [funcStract];
2421fb726d48Sopenharmony_ci    filterRow!.highlight = highlight;
2422fb726d48Sopenharmony_ci    let row = this.rowsEL!.querySelector<TraceRow<BaseStruct>>( // @ts-ignore
2423fb726d48Sopenharmony_ci      `trace-row[row-id='${Utils.getDistributedRowId(funcStract.pid)}'][folder]`
2424fb726d48Sopenharmony_ci    );
2425fb726d48Sopenharmony_ci    this.currentRow = row;
2426fb726d48Sopenharmony_ci    if (row && !row.expansion) {
2427fb726d48Sopenharmony_ci      row.expansion = true;
2428fb726d48Sopenharmony_ci    }
2429fb726d48Sopenharmony_ci    const completeEntry = (): void => {
2430fb726d48Sopenharmony_ci      this.toTargetDepth(filterRow.fixedList[0], funcRowID, funcStract);
2431fb726d48Sopenharmony_ci    };
2432fb726d48Sopenharmony_ci    if (filterRow!.isComplete) {
2433fb726d48Sopenharmony_ci      completeEntry();
2434fb726d48Sopenharmony_ci    } else {
2435fb726d48Sopenharmony_ci      // @ts-ignore
2436fb726d48Sopenharmony_ci      this.scrollToProcess(`${funcStract.tid}`, `${funcStract.pid}`, 'thread', false); // @ts-ignore
2437fb726d48Sopenharmony_ci      this.scrollToFunction(`${funcStract.tid}`, `${funcStract.pid}`, 'func', true);
2438fb726d48Sopenharmony_ci      // filterRow!.onComplete = completeEntry;
2439fb726d48Sopenharmony_ci      completeEntry();
2440fb726d48Sopenharmony_ci    }
2441fb726d48Sopenharmony_ci  }
2442fb726d48Sopenharmony_ci
2443fb726d48Sopenharmony_ci  closeAllExpandRows(pid: string): void {
2444fb726d48Sopenharmony_ci    let expandRows = this.rowsEL?.querySelectorAll<TraceRow<ProcessStruct>>("trace-row[row-type='process'][expansion]");
2445fb726d48Sopenharmony_ci    expandRows?.forEach((row): void => {
2446fb726d48Sopenharmony_ci      if (row.rowId !== pid) {
2447fb726d48Sopenharmony_ci        row.expansion = false;
2448fb726d48Sopenharmony_ci      }
2449fb726d48Sopenharmony_ci    });
2450fb726d48Sopenharmony_ci  }
2451fb726d48Sopenharmony_ci
2452fb726d48Sopenharmony_ci  moveRangeToLeft(startTime: number, dur: number): void {
2453fb726d48Sopenharmony_ci    let startNS = this.timerShaftEL?.getRange()?.startNS || 0;
2454fb726d48Sopenharmony_ci    let endNS = this.timerShaftEL?.getRange()?.endNS || 0;
2455fb726d48Sopenharmony_ci    let harfDur = Math.trunc(endNS - startNS - dur / 2);
2456fb726d48Sopenharmony_ci    let leftNs = startTime;
2457fb726d48Sopenharmony_ci    let rightNs = startTime + dur + harfDur;
2458fb726d48Sopenharmony_ci    if (startTime - harfDur < 0) {
2459fb726d48Sopenharmony_ci      leftNs = 0;
2460fb726d48Sopenharmony_ci      rightNs += harfDur - startTime;
2461fb726d48Sopenharmony_ci    }
2462fb726d48Sopenharmony_ci    this.timerShaftEL?.setRangeNS(leftNs, rightNs);
2463fb726d48Sopenharmony_ci    TraceRow.range!.refresh = true;
2464fb726d48Sopenharmony_ci    this.refreshCanvas(true, 'move range to left');
2465fb726d48Sopenharmony_ci  }
2466fb726d48Sopenharmony_ci
2467fb726d48Sopenharmony_ci  moveRangeToCenter(startTime: number, dur: number): void {
2468fb726d48Sopenharmony_ci    let startNS = this.timerShaftEL?.getRange()?.startNS || 0;
2469fb726d48Sopenharmony_ci    let endNS = this.timerShaftEL?.getRange()?.endNS || 0;
2470fb726d48Sopenharmony_ci    let harfDur = Math.trunc((endNS - startNS) / 2 - dur / 2);
2471fb726d48Sopenharmony_ci    let leftNs = startTime - harfDur;
2472fb726d48Sopenharmony_ci    let rightNs = startTime + dur + harfDur;
2473fb726d48Sopenharmony_ci    if (startTime - harfDur < 0) {
2474fb726d48Sopenharmony_ci      leftNs = 0;
2475fb726d48Sopenharmony_ci      rightNs += harfDur - startTime;
2476fb726d48Sopenharmony_ci    }
2477fb726d48Sopenharmony_ci    this.timerShaftEL?.setRangeNS(leftNs, rightNs);
2478fb726d48Sopenharmony_ci    TraceRow.range!.refresh = true;
2479fb726d48Sopenharmony_ci    this.refreshCanvas(true, 'move range to center');
2480fb726d48Sopenharmony_ci  }
2481fb726d48Sopenharmony_ci
2482fb726d48Sopenharmony_ci  rechargeCpuData(it: CpuStruct, next: CpuStruct | undefined): void {
2483fb726d48Sopenharmony_ci    let p = Utils.getInstance().getProcessMap().get(it.processId!);
2484fb726d48Sopenharmony_ci    let t = Utils.getInstance().getThreadMap().get(it.tid!);
2485fb726d48Sopenharmony_ci    let slice = Utils.getInstance().getSchedSliceMap().get(`${it.id}-${it.startTime}`);
2486fb726d48Sopenharmony_ci    if (slice) {
2487fb726d48Sopenharmony_ci      it.end_state = slice.endState;
2488fb726d48Sopenharmony_ci      it.priority = slice.priority;
2489fb726d48Sopenharmony_ci    }
2490fb726d48Sopenharmony_ci    it.processName = p;
2491fb726d48Sopenharmony_ci    it.processCmdLine = p;
2492fb726d48Sopenharmony_ci    it.name = t;
2493fb726d48Sopenharmony_ci    if (next) {
2494fb726d48Sopenharmony_ci      if (it.startTime! + it.dur! > next!.startTime! || it.dur === -1 || it.dur === null || it.dur === undefined) {
2495fb726d48Sopenharmony_ci        it.dur = next!.startTime! - it.startTime!;
2496fb726d48Sopenharmony_ci        it.nofinish = true;
2497fb726d48Sopenharmony_ci      }
2498fb726d48Sopenharmony_ci    } else {
2499fb726d48Sopenharmony_ci      if (it.dur === -1 || it.dur === null || it.dur === undefined) {
2500fb726d48Sopenharmony_ci        it.dur = TraceRow.range!.endNS - it.startTime!;
2501fb726d48Sopenharmony_ci        it.nofinish = true;
2502fb726d48Sopenharmony_ci      }
2503fb726d48Sopenharmony_ci    }
2504fb726d48Sopenharmony_ci  }
2505fb726d48Sopenharmony_ci
2506fb726d48Sopenharmony_ci  reset(progress: Function | undefined | null): void {
2507fb726d48Sopenharmony_ci    this.visibleRows.length = 0;
2508fb726d48Sopenharmony_ci    this.tipEL!.style.display = 'none';
2509fb726d48Sopenharmony_ci    this.canvasPanelCtx?.clearRect(0, 0, this.canvasPanel!.clientWidth, this.canvasPanel!.offsetHeight);
2510fb726d48Sopenharmony_ci    this.loadTraceCompleted = false;
2511fb726d48Sopenharmony_ci    this.collectRows = [];
2512fb726d48Sopenharmony_ci    this.visibleRows = [];
2513fb726d48Sopenharmony_ci    TraceRowConfig.allTraceRowList.forEach((it) => {
2514fb726d48Sopenharmony_ci      it.clearMemory();
2515fb726d48Sopenharmony_ci    });
2516fb726d48Sopenharmony_ci    TraceRowConfig.allTraceRowList = [];
2517fb726d48Sopenharmony_ci    this.favoriteChartListEL!.reset();
2518fb726d48Sopenharmony_ci    if (this.rowsEL) {
2519fb726d48Sopenharmony_ci      // @ts-ignore
2520fb726d48Sopenharmony_ci      this.rowsEL.querySelectorAll<TraceRow<unknown>>('trace-row').forEach((row) => {
2521fb726d48Sopenharmony_ci        row.clearMemory();
2522fb726d48Sopenharmony_ci        this.rowsEL!.removeChild(row);
2523fb726d48Sopenharmony_ci      });
2524fb726d48Sopenharmony_ci    }
2525fb726d48Sopenharmony_ci    this.traceSheetEL?.clearMemory();
2526fb726d48Sopenharmony_ci    this.spacerEL!.style.height = '0px';
2527fb726d48Sopenharmony_ci    this.rangeSelect.rangeTraceRow = [];
2528fb726d48Sopenharmony_ci    SpSystemTrace.SDK_CONFIG_MAP = undefined;
2529fb726d48Sopenharmony_ci    SpSystemTrace.sliceRangeMark = undefined;
2530fb726d48Sopenharmony_ci    this.timerShaftEL?.displayCollect(false);
2531fb726d48Sopenharmony_ci    this.timerShaftEL!.collecBtn!.removeAttribute('close');
2532fb726d48Sopenharmony_ci    CpuStruct.wakeupBean = undefined;
2533fb726d48Sopenharmony_ci    this.selectStructNull();
2534fb726d48Sopenharmony_ci    this.hoverStructNull();
2535fb726d48Sopenharmony_ci    this.wakeupListNull();
2536fb726d48Sopenharmony_ci    this.traceSheetEL?.setMode('hidden');
2537fb726d48Sopenharmony_ci    progress?.('rest timershaft', 8);
2538fb726d48Sopenharmony_ci    this.timerShaftEL?.reset();
2539fb726d48Sopenharmony_ci    progress?.('clear cache', 10);
2540fb726d48Sopenharmony_ci    HeapDataInterface.getInstance().clearData();
2541fb726d48Sopenharmony_ci    procedurePool.clearCache();
2542fb726d48Sopenharmony_ci    Utils.clearData();
2543fb726d48Sopenharmony_ci    InitAnalysis.getInstance().isInitAnalysis = true;
2544fb726d48Sopenharmony_ci    procedurePool.submitWithName('logic0', 'clear', {}, undefined, (res: unknown) => { });
2545fb726d48Sopenharmony_ci    if (threadPool) {
2546fb726d48Sopenharmony_ci      threadPool.submitProto(QueryEnum.ClearMemoryCache, {}, (res: unknown, len: number): void => { });
2547fb726d48Sopenharmony_ci    }
2548fb726d48Sopenharmony_ci    if (threadPool2) {
2549fb726d48Sopenharmony_ci      threadPool2.submitProto(QueryEnum.ClearMemoryCache, {}, (res: unknown, len: number): void => { });
2550fb726d48Sopenharmony_ci    }
2551fb726d48Sopenharmony_ci    this.times.clear();
2552fb726d48Sopenharmony_ci    resetVSync();
2553fb726d48Sopenharmony_ci    SpSystemTrace.keyPathList = [];
2554fb726d48Sopenharmony_ci    Utils.isTransformed = false;
2555fb726d48Sopenharmony_ci  }
2556fb726d48Sopenharmony_ci
2557fb726d48Sopenharmony_ci  init = async (
2558fb726d48Sopenharmony_ci    param: { buf?: ArrayBuffer; url?: string; buf2?: ArrayBuffer; fileName1?: string; fileName2?: string },
2559fb726d48Sopenharmony_ci    wasmConfigUri: string,
2560fb726d48Sopenharmony_ci    progress: Function,
2561fb726d48Sopenharmony_ci    isDistributed: boolean
2562fb726d48Sopenharmony_ci  ): Promise<unknown> => {
2563fb726d48Sopenharmony_ci    return spSystemTraceInit(this, param, wasmConfigUri, progress, isDistributed);
2564fb726d48Sopenharmony_ci  };
2565fb726d48Sopenharmony_ci  // @ts-ignore
2566fb726d48Sopenharmony_ci  extracted(it: TraceRow<unknown>) {
2567fb726d48Sopenharmony_ci    return (): void => {
2568fb726d48Sopenharmony_ci      if (it.hasAttribute('expansion')) {
2569fb726d48Sopenharmony_ci        it.childrenList.forEach((child): void => {
2570fb726d48Sopenharmony_ci          if (child.hasAttribute('scene') && !child.collect) {
2571fb726d48Sopenharmony_ci            child.rowHidden = false;
2572fb726d48Sopenharmony_ci          }
2573fb726d48Sopenharmony_ci          if (child.folder) {
2574fb726d48Sopenharmony_ci            child.addEventListener('expansion-change', this.extracted(child));
2575fb726d48Sopenharmony_ci          }
2576fb726d48Sopenharmony_ci          this.intersectionObserver?.observe(child);
2577fb726d48Sopenharmony_ci        });
2578fb726d48Sopenharmony_ci      } else {
2579fb726d48Sopenharmony_ci        //@ts-ignore
2580fb726d48Sopenharmony_ci        let parentElTopHeight = it.hasParentRowEl ? //@ts-ignore
2581fb726d48Sopenharmony_ci          (it.parentRowEl.getBoundingClientRect().top + it.parentRowEl.clientHeight) : this.rowsPaneEL!.getBoundingClientRect().top;
2582fb726d48Sopenharmony_ci        it.childrenList.forEach((child): void => {
2583fb726d48Sopenharmony_ci          if (child.hasAttribute('scene') && !child.collect) {
2584fb726d48Sopenharmony_ci            child.rowHidden = true;
2585fb726d48Sopenharmony_ci            this.intersectionObserver?.unobserve(child);
2586fb726d48Sopenharmony_ci          }
2587fb726d48Sopenharmony_ci          if (child.folder) {
2588fb726d48Sopenharmony_ci            child.removeEventListener('expansion-change', this.extracted(child));
2589fb726d48Sopenharmony_ci          }
2590fb726d48Sopenharmony_ci        });
2591fb726d48Sopenharmony_ci        if (it.getBoundingClientRect().top < 0) {
2592fb726d48Sopenharmony_ci          this.rowsPaneEL!.scrollTop =
2593fb726d48Sopenharmony_ci            this.rowsPaneEL!.scrollTop -
2594fb726d48Sopenharmony_ci            (it.getBoundingClientRect().top * -1 + parentElTopHeight);
2595fb726d48Sopenharmony_ci        } else if (it.getBoundingClientRect().top > 0) {
2596fb726d48Sopenharmony_ci          this.rowsPaneEL!.scrollTop =
2597fb726d48Sopenharmony_ci            parentElTopHeight <
2598fb726d48Sopenharmony_ci              it.getBoundingClientRect().top ?
2599fb726d48Sopenharmony_ci              this.rowsPaneEL!.scrollTop :
2600fb726d48Sopenharmony_ci              this.rowsPaneEL!.scrollTop -
2601fb726d48Sopenharmony_ci              (parentElTopHeight - it.getBoundingClientRect().top);
2602fb726d48Sopenharmony_ci        } else {
2603fb726d48Sopenharmony_ci          this.rowsPaneEL!.scrollTop =
2604fb726d48Sopenharmony_ci            this.rowsPaneEL!.scrollTop -
2605fb726d48Sopenharmony_ci            parentElTopHeight;
2606fb726d48Sopenharmony_ci        }
2607fb726d48Sopenharmony_ci        this.linkNodes.map((value): void => {
2608fb726d48Sopenharmony_ci          if ('task' === value[0].business && value[0].rowEL.parentRowEl?.rowId === it.rowId) {
2609fb726d48Sopenharmony_ci            value[0].hidden = true;
2610fb726d48Sopenharmony_ci            value[1].hidden = true;
2611fb726d48Sopenharmony_ci            this.clickEmptyArea();
2612fb726d48Sopenharmony_ci          }
2613fb726d48Sopenharmony_ci        });
2614fb726d48Sopenharmony_ci      }
2615fb726d48Sopenharmony_ci      this.resetDistributedLine();
2616fb726d48Sopenharmony_ci      if (!this.collapseAll) {
2617fb726d48Sopenharmony_ci        this.refreshCanvas(false, 'extracted');
2618fb726d48Sopenharmony_ci      }
2619fb726d48Sopenharmony_ci    };
2620fb726d48Sopenharmony_ci  }
2621fb726d48Sopenharmony_ci
2622fb726d48Sopenharmony_ci  resetDistributedLine(): void {
2623fb726d48Sopenharmony_ci    if (FuncStruct.selectFuncStruct) {
2624fb726d48Sopenharmony_ci      let dataList = FuncStruct.selectLineFuncStruct;
2625fb726d48Sopenharmony_ci      this.removeLinkLinesByBusinessType('distributed');
2626fb726d48Sopenharmony_ci      FuncStruct.selectLineFuncStruct = dataList;
2627fb726d48Sopenharmony_ci      for (let index = 0; index < FuncStruct.selectLineFuncStruct.length; index++) {
2628fb726d48Sopenharmony_ci        let sourceData = FuncStruct.selectLineFuncStruct[index];
2629fb726d48Sopenharmony_ci        if (index !== FuncStruct.selectLineFuncStruct.length - 1) {
2630fb726d48Sopenharmony_ci          let targetData = FuncStruct.selectLineFuncStruct[index + 1];
2631fb726d48Sopenharmony_ci          this.drawDistributedLine(sourceData, targetData, FuncStruct.selectFuncStruct!);
2632fb726d48Sopenharmony_ci        }
2633fb726d48Sopenharmony_ci      }
2634fb726d48Sopenharmony_ci      this.refreshCanvas(true);
2635fb726d48Sopenharmony_ci    }
2636fb726d48Sopenharmony_ci  }
2637fb726d48Sopenharmony_ci
2638fb726d48Sopenharmony_ci  // @ts-ignore
2639fb726d48Sopenharmony_ci  displayTip(row: TraceRow<unknown>, struct: unknown, html: string): void {
2640fb726d48Sopenharmony_ci    let x = row.hoverX + 248;
2641fb726d48Sopenharmony_ci    let y = row.getBoundingClientRect().top - this.getBoundingClientRect().top;
2642fb726d48Sopenharmony_ci    if ((struct === undefined || struct === null) && this.tipEL) {
2643fb726d48Sopenharmony_ci      this.tipEL.style.display = 'none';
2644fb726d48Sopenharmony_ci      return;
2645fb726d48Sopenharmony_ci    }
2646fb726d48Sopenharmony_ci    if (this.tipEL) {
2647fb726d48Sopenharmony_ci      this.tipEL.innerHTML = html;
2648fb726d48Sopenharmony_ci      if (
2649fb726d48Sopenharmony_ci        row.rowType === TraceRow.ROW_TYPE_JS_CPU_PROFILER ||
2650fb726d48Sopenharmony_ci        row.rowType === TraceRow.ROW_TYPE_PERF_CALLCHART ||
2651fb726d48Sopenharmony_ci        row.rowType === TraceRow.ROW_TYPE_BINDER_COUNT
2652fb726d48Sopenharmony_ci      ) {
2653fb726d48Sopenharmony_ci        this.tipEL.style.maxWidth = `${row.clientWidth / 3} px`;
2654fb726d48Sopenharmony_ci        this.tipEL.style.wordBreak = ' break-all';
2655fb726d48Sopenharmony_ci        this.tipEL.style.height = 'unset';
2656fb726d48Sopenharmony_ci        this.tipEL.style.display = 'block'; // @ts-ignore
2657fb726d48Sopenharmony_ci        y = y + struct.depth * 20;
2658fb726d48Sopenharmony_ci        if (row.rowType === TraceRow.ROW_TYPE_BINDER_COUNT) {
2659fb726d48Sopenharmony_ci          this.tipEL.style.height = 'auto';
2660fb726d48Sopenharmony_ci          y = row.hoverY + row.getBoundingClientRect().top - this.getBoundingClientRect().top;
2661fb726d48Sopenharmony_ci        }
2662fb726d48Sopenharmony_ci      } else {
2663fb726d48Sopenharmony_ci        this.tipEL.style.display = 'flex';
2664fb726d48Sopenharmony_ci        this.tipEL.style.height = row.style.height;
2665fb726d48Sopenharmony_ci      }
2666fb726d48Sopenharmony_ci      if (x + this.tipEL.clientWidth > (this.canvasPanel!.clientWidth ?? 0)) {
2667fb726d48Sopenharmony_ci        this.tipEL.style.transform = `translateX(${x - this.tipEL.clientWidth - 1}px) translateY(${y}px)`;
2668fb726d48Sopenharmony_ci      } else {
2669fb726d48Sopenharmony_ci        this.tipEL.style.transform = `translateX(${x}px) translateY(${y}px)`;
2670fb726d48Sopenharmony_ci      }
2671fb726d48Sopenharmony_ci    }
2672fb726d48Sopenharmony_ci  }
2673fb726d48Sopenharmony_ci
2674fb726d48Sopenharmony_ci  queryCPUWakeUpList(data: WakeupBean): void {
2675fb726d48Sopenharmony_ci    if (this._checkclick) {
2676fb726d48Sopenharmony_ci      this.wakeupListTbl!.loading = true;
2677fb726d48Sopenharmony_ci    }
2678fb726d48Sopenharmony_ci    TabPaneCurrentSelection.queryCPUWakeUpListFromBean(data).then((a: unknown) => {
2679fb726d48Sopenharmony_ci      if (a === null) {
2680fb726d48Sopenharmony_ci        window.publish(window.SmartEvent.UI.WakeupList, SpSystemTrace.wakeupList);
2681fb726d48Sopenharmony_ci        this.wakeupListTbl!.loading = false;
2682fb726d48Sopenharmony_ci        this._checkclick = false;
2683fb726d48Sopenharmony_ci        this.refreshCanvas(true);
2684fb726d48Sopenharmony_ci        return null;
2685fb726d48Sopenharmony_ci      } // @ts-ignore
2686fb726d48Sopenharmony_ci      SpSystemTrace.wakeupList.push(a); // @ts-ignore
2687fb726d48Sopenharmony_ci      this.queryCPUWakeUpList(a);
2688fb726d48Sopenharmony_ci    });
2689fb726d48Sopenharmony_ci  }
2690fb726d48Sopenharmony_ci
2691fb726d48Sopenharmony_ci  wakeupListNull(): SpSystemTrace {
2692fb726d48Sopenharmony_ci    SpSystemTrace.wakeupList = [];
2693fb726d48Sopenharmony_ci    return this;
2694fb726d48Sopenharmony_ci  }
2695fb726d48Sopenharmony_ci
2696fb726d48Sopenharmony_ci  initPointToEvent(): void {
2697fb726d48Sopenharmony_ci    spSystemTraceInitPointToEvent(this);
2698fb726d48Sopenharmony_ci  }
2699fb726d48Sopenharmony_ci
2700fb726d48Sopenharmony_ci  initHtml(): string {
2701fb726d48Sopenharmony_ci    return SpSystemTraceHtml;
2702fb726d48Sopenharmony_ci  }
2703fb726d48Sopenharmony_ci}
2704