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