diff --git a/ide/src/trace/component/SpSystemTrace.ts b/ide/src/trace/component/SpSystemTrace.ts index 4c434a1cf1b2ddc05628bc92c50666c030c451d6..b55b330243af8ba7e334339a69865dacb3bf1785 100644 --- a/ide/src/trace/component/SpSystemTrace.ts +++ b/ide/src/trace/component/SpSystemTrace.ts @@ -272,9 +272,13 @@ export class SpSystemTrace extends BaseElement { if (SpSystemTrace.btnTimer) { return; } - this.wakeupListNull(); - SpSystemTrace.wakeupList.unshift(CpuStruct.wakeupBean!); - this.queryCPUWakeUpList(CpuStruct.wakeupBean!); + // 唤醒树有值则不再重复添加 + if (SpSystemTrace.wakeupList.length === 0) { + SpSystemTrace.wakeupList.unshift(CpuStruct.wakeupBean!); + this.queryCPUWakeUpList(CpuStruct.wakeupBean!); + CpuStruct.selectCpuStruct!.ts = CpuStruct.selectCpuStruct!.startTime; + sessionStorage.setItem('saveselectcpustruct', JSON.stringify(CpuStruct.selectCpuStruct)) + } setTimeout(() => { requestAnimationFrame(() => this.refreshCanvas(false)); }, 300); @@ -437,7 +441,9 @@ export class SpSystemTrace extends BaseElement { replaceRow.setAttribute('row-parent-id', currentRow.rowParentId); replaceRow.style.display = 'none'; if (!currentRow.hasAttribute('scene')) { + currentRow.setAttribute('row-hidden', ''); +>>>>>>> master } else { currentRow.removeAttribute('row-hidden'); } @@ -716,8 +722,8 @@ export class SpSystemTrace extends BaseElement { let isIntersect = (filterFunc: FuncStruct, rangeData: RangeSelectStruct) => Math.max(filterFunc.startTs! + filterFunc.dur!, rangeData!.endNS || 0) - - Math.min(filterFunc.startTs!, rangeData!.startNS || 0) < - filterFunc.dur! + (rangeData!.endNS || 0) - (rangeData!.startNS || 0) && + Math.min(filterFunc.startTs!, rangeData!.startNS || 0) < + filterFunc.dur! + (rangeData!.endNS || 0) - (rangeData!.startNS || 0) && filterFunc.funName!.indexOf('H:Task ') >= 0; let taskData = it.dataList.filter((taskData: FuncStruct) => { taskData!.tid = parseInt(it.rowId!); @@ -1073,7 +1079,7 @@ export class SpSystemTrace extends BaseElement { } else if (it.rowType == TraceRow.ROW_TYPE_JANK) { let isIntersect = (filterJank: JanksStruct, rangeData: RangeSelectStruct) => Math.max(filterJank.ts! + filterJank.dur!, rangeData!.endNS || 0) - - Math.min(filterJank.ts!, rangeData!.startNS || 0) < + Math.min(filterJank.ts!, rangeData!.startNS || 0) < filterJank.dur! + (rangeData!.endNS || 0) - (rangeData!.startNS || 0); if (it.name == 'Actual Timeline') { selection.jankFramesData = []; @@ -1156,7 +1162,7 @@ export class SpSystemTrace extends BaseElement { } else if (it.rowType == TraceRow.ROW_TYPE_FRAME_ANIMATION) { let isIntersect = (animationStruct: FrameAnimationStruct, selectStruct: RangeSelectStruct) => Math.max(animationStruct.startTs! + animationStruct.dur!, selectStruct!.endNS || 0) - - Math.min(animationStruct.startTs!, selectStruct!.startNS || 0) < + Math.min(animationStruct.startTs!, selectStruct!.startNS || 0) < animationStruct.dur! + (selectStruct!.endNS || 0) - (selectStruct!.startNS || 0); let frameAnimationList = it.dataList.filter((frameAnimationBean: FrameAnimationStruct) => { return isIntersect(frameAnimationBean, TraceRow.rangeSelectObject!); @@ -1330,7 +1336,7 @@ export class SpSystemTrace extends BaseElement { window.subscribe(window.SmartEvent.UI.SliceMark, (data) => { this.sliceMarkEventHandler(data); }); - window.subscribe(window.SmartEvent.UI.TraceRowComplete, (tr) => {}); + window.subscribe(window.SmartEvent.UI.TraceRowComplete, (tr) => { }); window.subscribe(window.SmartEvent.UI.RefreshCanvas, () => { this.refreshCanvas(false); }); @@ -1387,11 +1393,11 @@ export class SpSystemTrace extends BaseElement { return this.favoriteChartListEL!.getCollectRows(condition); } - getAllCollectRows(): Array> { + getAllCollectRows() { return this.favoriteChartListEL!.getCollectRows('trace-row'); } - getAllSelectCollectRows(): Array> { + getAllSelectCollectRows() { return this.favoriteChartListEL!.getCollectRows("trace-row[check-type='2']"); } @@ -1790,7 +1796,7 @@ export class SpSystemTrace extends BaseElement { // 如果没有找到帽子,则绘制一个旗子 let time = Math.round( (x * (TraceRow.range?.endNS! - TraceRow.range?.startNS!)) / this.timerShaftEL!.canvas!.offsetWidth + - TraceRow.range?.startNS! + TraceRow.range?.startNS! ); this.timerShaftEL!.sportRuler!.drawTriangle(time, 'squre'); } @@ -1956,13 +1962,13 @@ export class SpSystemTrace extends BaseElement { this.timerShaftEL?.setSlicesMark( FrameAnimationStruct.selectFrameAnimationStruct.startTs || 0, (FrameAnimationStruct.selectFrameAnimationStruct.startTs || 0) + - (FrameAnimationStruct.selectFrameAnimationStruct.dur || 0) + (FrameAnimationStruct.selectFrameAnimationStruct.dur || 0) ); } else if (JsCpuProfilerStruct.selectJsCpuProfilerStruct) { this.timerShaftEL?.setSlicesMark( JsCpuProfilerStruct.selectJsCpuProfilerStruct.startTime || 0, (JsCpuProfilerStruct.selectJsCpuProfilerStruct.startTime || 0) + - (JsCpuProfilerStruct.selectJsCpuProfilerStruct.totalTime || 0) + (JsCpuProfilerStruct.selectJsCpuProfilerStruct.totalTime || 0) ); } else { this.slicestime = this.timerShaftEL?.setSlicesMark(); @@ -2504,7 +2510,30 @@ export class SpSystemTrace extends BaseElement { if (!this.loadTraceCompleted) return; this.queryAllTraceRow().forEach((it) => (it.rangeSelect = false)); this.selectStructNull(); - this.wakeupListNull(); + // 判断点击的线程是否在唤醒树内 + let timeoutJudge = setTimeout(() => { + if (SpSystemTrace.wakeupList.length && CpuStruct.wakeupBean) { + let checkHandlerKey = true; + for (const item of SpSystemTrace.wakeupList) { + if (item.ts === CpuStruct.wakeupBean.ts && item.wakeupTime === CpuStruct.wakeupBean.wakeupTime) { + checkHandlerKey = false; + if (SpSystemTrace.wakeupList[0].itid) { + SpSystemTrace.wakeupList.unshift(JSON.parse(sessionStorage.getItem('saveselectcpustruct')!)) + } + this.refreshCanvas(true) + break; + } + } + if (checkHandlerKey) { + this.wakeupListNull() + this.refreshCanvas(true) + } + } else { + this.wakeupListNull(); + this.refreshCanvas(true) + } + clearTimeout(timeoutJudge) + }, 500); let threadClickHandler: any; let threadClickPreviousHandler: any; let threadClickNextHandler: any; @@ -4186,8 +4215,8 @@ export class SpSystemTrace extends BaseElement { HeapDataInterface.getInstance().clearData(); procedurePool.clearCache(); Utils.clearData(); - procedurePool.submitWithName('logic0', 'clear', {}, undefined, (res: any) => {}); - procedurePool.submitWithName('logic1', 'clear', {}, undefined, (res: any) => {}); + procedurePool.submitWithName('logic0', 'clear', {}, undefined, (res: any) => { }); + procedurePool.submitWithName('logic1', 'clear', {}, undefined, (res: any) => { }); } init = async (param: { buf?: ArrayBuffer; url?: string }, wasmConfigUri: string, progress: Function) => { diff --git a/ide/src/trace/database/ui-worker/ProcedureWorkerCPU.ts b/ide/src/trace/database/ui-worker/ProcedureWorkerCPU.ts index cc09e7bf2a0a1a662756232569d9a6321cd562c9..374a5329be2709bbdb09de978dc9acc55db168c8 100644 --- a/ide/src/trace/database/ui-worker/ProcedureWorkerCPU.ts +++ b/ide/src/trace/database/ui-worker/ProcedureWorkerCPU.ts @@ -299,6 +299,7 @@ export class CpuStruct extends BaseStruct { type: string | undefined; v: boolean = false; nofinish: boolean = false; + ts:number | undefined; static draw(ctx: CanvasRenderingContext2D, data: CpuStruct, translateY: number) { if (data.frame) { let width = data.frame.width || 0;