diff --git a/ide/src/trace/SpApplication.ts b/ide/src/trace/SpApplication.ts index 9bdcf438abdec7e1fd42b2582e7fabc927edfc0e..37e1d0a31283cf4eab390f3e022e86326a87c061 100644 --- a/ide/src/trace/SpApplication.ts +++ b/ide/src/trace/SpApplication.ts @@ -178,6 +178,7 @@ export class SpApplication extends BaseElement { private currentDataTime: string[] = []; static traceType: String = ''; private isZipFile: boolean = false; + isClear: boolean = false; static get observedAttributes(): Array { return ['server', 'sqlite', 'wasm', 'dark', 'vs', 'query-sql', 'subsection']; @@ -1997,7 +1998,15 @@ export class SpApplication extends BaseElement { this.filterRowConfigClickHandle(); }); this.cutTraceFile!.addEventListener('click', (ev) => { - this.croppingFile(this.progressEL!, this.litSearch!); + this.validateFileCacheLost(); + if (this.isClear) { + let search = document.querySelector('body > sp-application')!.shadowRoot!.querySelector('#lit-search'); + let progressEL = document.querySelector("body > sp-application")!.shadowRoot!.querySelector("div > div.search-vessel > lit-progress-bar"); + progressEL!.loading = false; + search!.setPercent('import the trace file again...', -3); + } else { + this.croppingFile(this.progressEL!, this.litSearch!); + } }); let aiAnalysis = this.shadowRoot @@ -2254,8 +2263,10 @@ export class SpApplication extends BaseElement { } }); }); - this.cutTraceFile!.style.display = 'none'; + this.isClear = true; this.mainMenu!.menus = this.mainMenu!.menus; + } else { + this.isClear = false; } }); } diff --git a/ide/src/trace/bean/FrameChartStruct.ts b/ide/src/trace/bean/FrameChartStruct.ts index c4883a6a20880fadf53acbda6d788ce674b9ed6a..2d1fb221153bddd3e50a3bca19515e28283f20d4 100644 --- a/ide/src/trace/bean/FrameChartStruct.ts +++ b/ide/src/trace/bean/FrameChartStruct.ts @@ -68,6 +68,7 @@ export class ChartStruct extends BaseStruct { children: Array = []; percent: number = 0; // 0 - 1 该node所占整体的百分比 addr: string = ''; + isRemark:boolean = false; isSearch: boolean = false; isChartSelect: boolean = false; // 是否为点选的调用链 isChartSelectParent: boolean = false; // 用来显示灰色 diff --git a/ide/src/trace/component/SpAdvertisement.ts b/ide/src/trace/component/SpAdvertisement.ts index 9fcf8e6e63b07fb9c284ec48141918532380e1e4..d5ad2402a3a5e87576fbf41dc30138e171fec17a 100644 --- a/ide/src/trace/component/SpAdvertisement.ts +++ b/ide/src/trace/component/SpAdvertisement.ts @@ -54,11 +54,9 @@ export class SpAdvertisement extends BaseElement { this.message = resp.data.data; localStorage.setItem('message', this.message); let parts = this.message.split(';'); - let registrationLinkInfo = (parts[2].match(/报名链接:([^\s]+)/) || [])[1] || ''; - let onlineMeetingLinkInfo = (parts[3].match(/线上会议链接:([^\s]+)/) || [])[1] || ''; - let registrationLink = `报名链接`; - let onlineMeetingLink = `线上会议链接`; - let finalString = `${parts[0]}
${parts[1]}
${registrationLink}   ${onlineMeetingLink}
${parts[4]}`; + let registrationLinkInfo = (parts[2].match(/版本特性链接:([^\s]+)/) || [])[1] || ''; + let registrationLink = `版本特性链接`; + let finalString = `${parts[0]}
${parts[1]}
${registrationLink}`; this.noticeEl!.innerHTML = `

${finalString}

`; if (publish) { if (resp.data.data !== publish) { @@ -81,6 +79,7 @@ export class SpAdvertisement extends BaseElement { }); } + initHtml(): string { return SpAdvertisementHtml; } diff --git a/ide/src/trace/component/SpAiAnalysisPage.ts b/ide/src/trace/component/SpAiAnalysisPage.ts index c816f9a17fb84a5e60c9a2f723aac01ebc6b8885..5085b3609f2ef1a2a6c4b56440019b51e1cedb1b 100644 --- a/ide/src/trace/component/SpAiAnalysisPage.ts +++ b/ide/src/trace/component/SpAiAnalysisPage.ts @@ -831,7 +831,7 @@ export class SpAiAnalysisPage extends BaseElement { // 获取提示语 getStatusesPrompt(): unknown { let guideSrc = `https://${window.location.host.split(':')[0]}:${window.location.port - }/application/?action=help_27`; + }${window.location.pathname}?action=help_27`; return { unconnected: { prompt: `未连接,请启动本地扩展程序再试![指导]` diff --git a/ide/src/trace/component/SpRecordConfigModel.ts b/ide/src/trace/component/SpRecordConfigModel.ts index 27f1e0106b676a111b01c7cb3e0f855009612165..da0f365c966db3fe625dcbad65eea194ec6b460c 100644 --- a/ide/src/trace/component/SpRecordConfigModel.ts +++ b/ide/src/trace/component/SpRecordConfigModel.ts @@ -915,6 +915,9 @@ export function createXPowerConfig( let type = spXPower.getXpowerConfig(); let typeList: Array = []; typeList = type!.split(','); + if (type?.length === 0) { //没有默认值时 + typeList = ['REAL_BATTERY', 'THERMAL_REPORT']; + } let bundleName = spXPower.process || ''; let xPowerConfig = { bundle_name: bundleName, diff --git a/ide/src/trace/component/SpRecordTrace.ts b/ide/src/trace/component/SpRecordTrace.ts index f3c9eff96b899a242052874b54102f63043540ba..dad75ec02365ae532a22355d80dd81a9200a72b8 100644 --- a/ide/src/trace/component/SpRecordTrace.ts +++ b/ide/src/trace/component/SpRecordTrace.ts @@ -458,7 +458,7 @@ export class SpRecordTrace extends BaseElement { isShowTipFunc(text: string, isShow: boolean): void { if (isShow) { - let guideSrc = `https://${window.location.host.split(':')[0]}:${window.location.port}/application/?action=help_27`; + let guideSrc = `https://${window.location.host.split(':')[0]}:${window.location.port}${window.location.pathname}?action=help_27`; this.useExtentTip!.style.display = 'block'; // @ts-ignore this.useExtentTip!.innerHTML = `若要抓取${text},请勾选 Use local hdc 开关,启动后台扩展服务进行抓取,相关指导: [指导]`; @@ -583,7 +583,9 @@ export class SpRecordTrace extends BaseElement { this.progressEL!.loading = false;// @ts-ignore let errorMsg = new TextDecoder().decode(result); this.useExtentTip!.style.display = 'block'; - this.useExtentTip!.innerHTML = errorMsg; + let urlAsciiArr = [104,116,116,112,115,58,47,47,119,105,107,105,46,104,117,97,119,101,105,46,99,111,109,47,100,111,109,97,105,110,115,47,55,54,57,49,49,47,119,105,107,105,47,49,50,53,52,56,48,47,87,73,75,73,50,48,50,53,48,49,49,54,53,55,53,48,52,53,52]; + let exceptGuid = String.fromCodePoint(...urlAsciiArr);//'https://wiki.huawei.com/domains/76911/wiki/125480/WIKI202501165750454' + this.useExtentTip!.innerHTML = `抓取trace异常:${errorMsg} 可根据[常见异常处理]解决异常`; this.refreshDisableStyle(false, false); this.recordButton!.hidden = false; this.sp!.search = false; @@ -681,7 +683,7 @@ export class SpRecordTrace extends BaseElement { getStatusesPrompt(): unknown { let guideSrc = `https://${window.location.host.split(':')[0]}:${window.location.port - }/application/?action=help_27`; + }${window.location.pathname}?action=help_27`; return { unconnected: { prompt: `未连接,请启动本地扩展程序再试![指导]` @@ -973,7 +975,7 @@ export class SpRecordTrace extends BaseElement { let option = document.createElement('option'); option.className = 'select'; option.selected = supportVersion === '5.0+'; - option.textContent =`OpenHarmony-${supportVersion}`; + option.textContent = `OpenHarmony-${supportVersion}`; option.setAttribute('device-version', supportVersion); this.deviceVersion!.append(option); SpRecordTrace.selectVersion = '5.0+'; diff --git a/ide/src/trace/component/SpSystemTrace.event.ts b/ide/src/trace/component/SpSystemTrace.event.ts index ea5bcd73b0a7d750060e7090193aa1258578cc57..25cf0d035a29b582f2623bfa6ebabb75df2d7ea7 100644 --- a/ide/src/trace/component/SpSystemTrace.event.ts +++ b/ide/src/trace/component/SpSystemTrace.event.ts @@ -964,16 +964,17 @@ function handleClickActions(sp: SpSystemTrace, x: number, y: number, ev: MouseEv } let skip = false; if ( - rows[0].rowType === TraceRow.ROW_TYPE_XPOWER_WIFI_BYTES || - rows[0].rowType === TraceRow.ROW_TYPE_XPOWER_WIFI_PACKETS || - rows[0].rowType === TraceRow.ROW_TYPE_XPOWER_APP_DETAIL_DISPLAY || - rows[0].rowType === TraceRow.ROW_TYPE_XPOWER_STATISTIC + rows[0] && + (rows[0].rowType === TraceRow.ROW_TYPE_XPOWER_WIFI_BYTES || + rows[0].rowType === TraceRow.ROW_TYPE_XPOWER_WIFI_PACKETS || + rows[0].rowType === TraceRow.ROW_TYPE_XPOWER_APP_DETAIL_DISPLAY || + rows[0].rowType === TraceRow.ROW_TYPE_XPOWER_STATISTIC) ) { skip = true; } if (rows && rows[0] && (rows[0].getHoverStruct(strict, offset) || (rows[0].rowType === TraceRow.ROW_TYPE_GPU_COUNTER && rows[0].getHoverStruct(false) || skip)) - ) { + ) { sp.onClickHandler(rows[0]!.rowType!, rows[0], rows[0].getHoverStruct(strict, offset)); sp.documentOnMouseMove(ev); } else { diff --git a/ide/src/trace/component/SpSystemTrace.init.ts b/ide/src/trace/component/SpSystemTrace.init.ts index f718f0243df73d1f999c31012445eea2270ff2f6..07f17399624aeff5e87ae0ca33e52e3915d65bd0 100644 --- a/ide/src/trace/component/SpSystemTrace.init.ts +++ b/ide/src/trace/component/SpSystemTrace.init.ts @@ -629,7 +629,9 @@ function selectHandler(sp: SpSystemTrace): void { ]; } checkRows = checkRows.filter((item, index, self) => { - return self.findIndex(obj => obj.rowId === item.rowId && obj.rowType === item.rowType && obj.name === item.name) === index; + return self.findIndex( + obj => obj.rowId === item.rowId && obj.rowType === item.rowType && obj.name === item.name && obj.rowParentId === item.rowParentId + ) === index; }); selectHandlerRefreshCheckBox(sp, checkRows, refreshCheckBox); if (!sp.isSelectClick) { diff --git a/ide/src/trace/component/SpSystemTrace.ts b/ide/src/trace/component/SpSystemTrace.ts index f1697b7116f254d0b2af31757f73df179a937b84..ecda6e33c2384cc69b1fcb2c1384f4c68ee71573 100644 --- a/ide/src/trace/component/SpSystemTrace.ts +++ b/ide/src/trace/component/SpSystemTrace.ts @@ -142,6 +142,7 @@ import { XpowerStatisticStruct } from '../database/ui-worker/ProcedureWorkerXpow import { XpowerWifiStruct } from '../database/ui-worker/ProcedureWorkerXpowerWifi'; import { XpowerThreadInfoStruct } from '../database/ui-worker/ProcedureWorkerXpowerThreadInfo'; import { XpowerGpuFreqStruct } from '../database/ui-worker/ProcedureWorkerXpowerGpuFreq'; +import { LitProgressBar } from '../../base-ui/progress-bar/LitProgressBar'; function dpr(): number { return window.devicePixelRatio || 1; @@ -972,6 +973,18 @@ export class SpSystemTrace extends BaseElement { documentOnMouseOut = (ev: MouseEvent): void => spSystemTraceDocumentOnMouseOut(this, ev); + documentOnPointercancel = (ev: any): void => {//@ts-ignore + if (ev.pointerType == 'mouse' && (window as unknown).isSheetMove) { + this.dispatchEvent( + new CustomEvent('abnormal-mouseup', { + detail: { + value: true, + }, + }) + ); + } + }; + keyPressMap: Map = new Map([ ['w', false], ['s', false], @@ -1760,6 +1773,7 @@ export class SpSystemTrace extends BaseElement { this.addEventListener('mousedown', this.documentOnMouseDown); this.addEventListener('mouseup', this.documentOnMouseUp); this.addEventListener('mouseout', this.documentOnMouseOut); + this.addEventListener('pointercancel', this.documentOnPointercancel); document.addEventListener('keydown', this.documentOnKeyDown); document.addEventListener('keypress', this.documentOnKeyPress); document.addEventListener('keyup', this.documentOnKeyUp); @@ -1810,8 +1824,13 @@ export class SpSystemTrace extends BaseElement { a.href = URL.createObjectURL(new Blob([`${markBuf.byteLength}`, mark, buffer])); // @ts-ignore a.download = (window as unknown).traceFileName || `${new Date().getTime()}`; a.click(); + window.publish(window.SmartEvent.UI.Loading, { loading: false, text: 'Downloading trace file with mark' }); + } else { + let search = document.querySelector('body > sp-application')!.shadowRoot!.querySelector('#lit-search'); + let progressEL = document.querySelector("body > sp-application")!.shadowRoot!.querySelector("div > div.search-vessel > lit-progress-bar"); + progressEL!.loading = false; + search!.setPercent('import the trace file again...', -3); } - window.publish(window.SmartEvent.UI.Loading, { loading: false, text: 'Downloading trace file with mark' }); } private subRecordImportListener(): void { @@ -2176,6 +2195,7 @@ export class SpSystemTrace extends BaseElement { this.removeEventListener('mousedown', this.documentOnMouseDown); this.removeEventListener('mouseup', this.documentOnMouseUp); this.removeEventListener('mouseout', this.documentOnMouseOut); + this.removeEventListener('pointercancel', this.documentOnPointercancel); document.removeEventListener('keypress', this.documentOnKeyPress); document.removeEventListener('keydown', this.documentOnKeyDown); document.removeEventListener('keyup', this.documentOnKeyUp); diff --git a/ide/src/trace/component/chart/FrameChart.ts b/ide/src/trace/component/chart/FrameChart.ts index 8bd52b36c56092d0c50467f5e4f5cbc3228ddd36..35e457e803c3cb3fe2da9d06bb960817b58fa15f 100644 --- a/ide/src/trace/component/chart/FrameChart.ts +++ b/ide/src/trace/component/chart/FrameChart.ts @@ -330,6 +330,15 @@ export class FrameChart extends BaseElement { this.setParentDisplayInfo(node, module, false); calDisplay = false; } + if (node.children && calDisplay && node.children.length === 0 && node.isRemark) { + const module = new NodeValue(); + module.size = node.drawSize = node.searchSize = node.size; + module.count = node.drawCount = node.searchCount = node.count; + module.dur = node.drawDur = node.searchDur = node.dur; + module.eventCount = node.drawEventCount = node.searchEventCount = node.eventCount; + this.setParentDisplayInfo(node, module, false); + calDisplay = false + } // 设置parent以及计算最大的深度 if (node.children && node.children.length > 0) { diff --git a/ide/src/trace/component/setting/SpRecordSetting.html.ts b/ide/src/trace/component/setting/SpRecordSetting.html.ts index 8b7d98752f9e5c223607a9911b54b3ec130290e5..c8fb6850a537c48ec30d488a651fba74ccddf200 100644 --- a/ide/src/trace/component/setting/SpRecordSetting.html.ts +++ b/ide/src/trace/component/setting/SpRecordSetting.html.ts @@ -217,7 +217,7 @@ button{
SnapShot - (max snapShot value is 1000MS) + (max snapShot value is 1000MS and min snapShot value is 200MS)
diff --git a/ide/src/trace/component/setting/SpXPowerRecord.ts b/ide/src/trace/component/setting/SpXPowerRecord.ts index eec8535ba07023ccd69fe16b217c5b347361926e..2cf987de460cfaa77165bdd41c791ee2c12dccf1 100644 --- a/ide/src/trace/component/setting/SpXPowerRecord.ts +++ b/ide/src/trace/component/setting/SpXPowerRecord.ts @@ -77,9 +77,13 @@ export class SpXPowerRecord extends BaseElement { return; } else { Cmd.getPackage().then((packageList) => { + let appArr = []; if (packageList.length > 0) { - packageList.unshift('none'); - this.xPowerSelectV!.dataSource(packageList, '', true); + packageList.forEach((item) => { + appArr.push(item.replace(/^\t+/, '')); + }) + appArr.unshift('none'); + this.xPowerSelectV!.dataSource(appArr, '', true); this.getSelectedOption(); } else { this.xPowerSelectV!.dataSource([], ''); diff --git a/ide/src/trace/component/trace/base/TraceRowConfig.ts b/ide/src/trace/component/trace/base/TraceRowConfig.ts index 52a392649387cefb00db48195993deca3fc7061c..78532cdd658e78e42d4b7f2ad5c202d013b058b8 100644 --- a/ide/src/trace/component/trace/base/TraceRowConfig.ts +++ b/ide/src/trace/component/trace/base/TraceRowConfig.ts @@ -330,6 +330,9 @@ export class TraceRowConfig extends BaseElement { } else { favoriteRow.removeAttribute('scene'); favoriteRow.rowHidden = true; + if (this.spSystemTrace?.favoriteChartListEL?.scrollTop && this.spSystemTrace?.favoriteChartListEL?.scrollTop > 0) { + this.spSystemTrace.favoriteChartListEL.scrollTop = 0; + } } } }); diff --git a/ide/src/trace/component/trace/base/TraceSheet.ts b/ide/src/trace/component/trace/base/TraceSheet.ts index 9ba7d113303f3a21ef00fe93c27274886782ad03..15f7c506f357344c1ccf4df9bae72e59ca4eb0f7 100644 --- a/ide/src/trace/component/trace/base/TraceSheet.ts +++ b/ide/src/trace/component/trace/base/TraceSheet.ts @@ -133,6 +133,8 @@ export class TraceSheet extends BaseElement { private optionsDiv: LitPopover | undefined | null; private optionsSettingTree: LitTree | undefined | null; private tabPaneHeight: string = ''; + private spsystemTrace: SpSystemTrace | undefined; + private isDragging = true; private REQ_BUF_SIZE = 1024 * 1024; static get observedAttributes(): string[] { @@ -184,6 +186,7 @@ export class TraceSheet extends BaseElement { } initElements(): void { + this.spsystemTrace = document.querySelector("body > sp-application")?.shadowRoot?.querySelector("#sp-system-trace") as SpSystemTrace; this.litTabs = this.shadowRoot?.querySelector('#tabs'); this.litTabs!.addEventListener('contextmenu', (e): void => { e.preventDefault(); @@ -472,6 +475,7 @@ export class TraceSheet extends BaseElement { let that = this; // 节点挂载时给Tab面板绑定鼠标按下事件 this.nav!.onmousedown = (event): void => { + this.isDragging = true; // @ts-ignore (window as unknown).isSheetMove = true; // 获取所有标签页的节点数组 @@ -484,6 +488,7 @@ export class TraceSheet extends BaseElement { // 原函数 绑定鼠标移动事件,动态获取鼠标位置信息 this.navMouseMove(event, currentPane!, that, tabsPackUp, borderTop); document.onmouseup = function (): void { + that.isDragging = true; setTimeout(() => { // @ts-ignore (window as unknown).isSheetMove = false; @@ -501,6 +506,24 @@ export class TraceSheet extends BaseElement { this.onmouseup = null; }; }; + this.spsystemTrace?.addEventListener('abnormal-mouseup', () => { + this.isDragging = false; + let litTabpane: NodeListOf | undefined | null = + this.shadowRoot?.querySelectorAll('#tabs > lit-tabpane'); + setTimeout(() => { + // @ts-ignore + (window as unknown).isSheetMove = false; + }, 100); + litTabpane!.forEach((node: HTMLDivElement): void => { + node!.style.height = that.tabPaneHeight; + }); + if (that.tabPaneHeight !== '0px' && that.tabs!.style.height !== '') { + initialHeight.node = that.tabPaneHeight; + initialHeight.tabs = that.tabs!.style.height; + } + this.onmousemove = null; + this.onmouseup = null; + }) } private navMouseMove( @@ -522,6 +545,9 @@ export class TraceSheet extends BaseElement { let ch = that.clientHeight; // 鼠标移动事件 document.onmousemove = function (event): void { + if (!that.isDragging) { + return; + } // 移动前的面板高度 - 移动前后鼠标的坐标差值 = 新的面板高度 let newHeight: number = preHeight - (event.pageY - preY); // that指向的是tracesheet节点 spacer为垫片 rowsPaneEl为泳道 tabs为tab页组件 diff --git a/ide/src/trace/component/trace/search/Search.ts b/ide/src/trace/component/trace/search/Search.ts index 517c8df9d2e44bf3cc0bc944bac41ae54126e893..58a09bfcf41177d218dd031bb5df885dff113d80 100644 --- a/ide/src/trace/component/trace/search/Search.ts +++ b/ide/src/trace/component/trace/search/Search.ts @@ -141,6 +141,17 @@ export class LitSearch extends BaseElement { setTimeout((): void => { this.setAttribute('textRoll', ''); }, 200); + } else if (value === -3) { + this.clear(); + searchHide!.style.display = 'flex'; + searchHide!.style.backgroundColor = 'var(--dark-background5,#e3e3e3)'; + searchIcon?.setAttribute('name', 'search'); + this.search!.setAttribute('placeholder', `${name}`); + this.search!.setAttribute('readonly', ''); + this.search!.className = 'text-Roll'; + setTimeout((): void => { + this.setAttribute('textRoll', ''); + }, 200); } else { searchHide!.style.display = 'none'; } diff --git a/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts b/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts index 51538ccd4d1348aae454e3367084911af7b2e2d9..eb8d30e7983a7f064b1f5b55c1db1b4a7f19aec3 100644 --- a/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts +++ b/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts @@ -1810,13 +1810,22 @@ export class TabPaneCurrentSelection extends BaseElement { value: ((data.startTs || 0) + Utils.getInstance().getRecordStartNS()) / 1000000000 + 's', }); if (data.dur && data.dur > 0) { - list.push({ - name: 'EndTime(Relative)', - value: `
-
${getTimeString((data.startTs || 0) + (data.dur || 0))}
- -
`, - }); + if (data.startName > 6) { + list.push({ + name: 'EndTime(Relative)', + value: `
+
${getTimeString((data.startTs || 0) + (data.dur || 0))}
+
`, + }); + } else { + list.push({ + name: 'EndTime(Relative)', + value: `
+
${getTimeString((data.startTs || 0) + (data.dur || 0))}
+ +
`, + }); + } list.push({ name: 'EndTime(Absolute)', value: ((data.startTs || 0) + (data.dur || 0) + Utils.getInstance().getRecordStartNS()) / 1000000000 + 's', @@ -1857,6 +1866,12 @@ export class TabPaneCurrentSelection extends BaseElement { sortedArray[index + 1].startTs )}`, }); + if (data.startName === 6) { + data.endstartTs = sortedArray[index + 1].startTs; + data.endItid = sortedArray[index + 1].itid; + } else { + data.endstartTs = data.startTs! + data.dur!; + } } }); this.currentSelectionTbl!.dataSource = list; @@ -1883,10 +1898,9 @@ export class TabPaneCurrentSelection extends BaseElement { let endIcon = this.currentSelectionTbl?.shadowRoot?.querySelector('#end-jump'); let scrollClick = (type: number): void => { let recordNs: number = Utils.getInstance().getRecordStartNS(); - let useEnd = type === 1 && data.startName! < 6; queryThreadByItid( - useEnd ? data.endItid! : data.itid!, - useEnd ? recordNs + data.startTs! + data.dur! : recordNs + data.startTs! + type === 0 ? data.itid! : data.endItid!, + type === 0 ? recordNs + data.startTs! : recordNs + data.endstartTs! ).then((result) => { if (result.length > 0) { //@ts-ignore @@ -1904,7 +1918,7 @@ export class TabPaneCurrentSelection extends BaseElement { dur: pt.dur, depth: pt.depth, funName: pt.name, - startTs: useEnd ? (data.startTs || 0) + (data.dur || 0) : data.startTs, + startTs: type === 0 ? data.startTs! : data.endstartTs!, keepOpen: true, }); } @@ -2411,6 +2425,7 @@ export class TabPaneCurrentSelection extends BaseElement { } }); this.updateTableSettings(maxPriority, maxPriorityDuration, maxDuration); + this.wakeupListTbl!.style.display = 'flex'; this.wakeupListTbl!.recycleDataSource = resource; }); } diff --git a/ide/src/trace/component/trace/sheet/cpu/TabPaneFrequencySample.ts b/ide/src/trace/component/trace/sheet/cpu/TabPaneFrequencySample.ts index b8db36c8cfefaa16a372e43e81cbc4e78263d3cc..0cc346542faf98e89d4e8c617565b605e6bece8a 100644 --- a/ide/src/trace/component/trace/sheet/cpu/TabPaneFrequencySample.ts +++ b/ide/src/trace/component/trace/sheet/cpu/TabPaneFrequencySample.ts @@ -200,7 +200,7 @@ export class TabPaneFrequencySample extends BaseElement { // @ts-ignore let tmpPosition = tmpCpuArr.findIndex(item => item[1].filterId === weightMapArr[j][1].filterId); if (singleCpuArr[0] && singleCpuArr[0].length >= 2) { - // @ts-ignore + // @ts-ignore tmpCpuArr.splice(tmpPosition, 0, [`${weightMapArr[j][1].filterId}-0`, { counter: `${singleCpuArr[0][1].counter}:( WA )`, time: tmpTotalTime, valueStr: ColorUtils.formatNumberComma(Math.round(tmpTotalCount / (tmpTotalTime / 1000000))) }]); } }; @@ -345,7 +345,7 @@ export class TabPaneFrequencySample extends BaseElement { value.busyTimeStr = '-'; } else { // @ts-ignore - value.busyTimeStr = type ? value.busyTime : '-'; + value.busyTimeStr = type ? (value.busyTime === 0 ? 'NULL' : value.busyTime) : '-'; } res.push(value); }); diff --git a/ide/src/trace/database/logic-worker/ProcedureLogicWorkerPerf.ts b/ide/src/trace/database/logic-worker/ProcedureLogicWorkerPerf.ts index 2f63034e2f72adebf39d074cce1a84d7ed4e90f3..3093bb4e68646bff0f9d9d4182bddbd87a2aad3b 100644 --- a/ide/src/trace/database/logic-worker/ProcedureLogicWorkerPerf.ts +++ b/ide/src/trace/database/logic-worker/ProcedureLogicWorkerPerf.ts @@ -994,10 +994,17 @@ export class ProcedureLogicWorkerPerf extends LogicHandler { process.isSearch = false; }); this.resetNewAllNode(sample); - if (this.searchValue !== '') { + if (this.searchValue[0] === '!') { + this.reMarkSearchNode(sample, this.searchValue.substring(1, this.searchValue.length), true); + } else if (this.searchValue[0] === '*') { + let reSearValue = this.searchValue.substring(1, this.searchValue.length); + this.markRegexSearchNode(this.allProcess, reSearValue, false) + } else if (this.searchValue[0] === '^') { + this.markUnRegexSearchNode(this.allProcess, this.searchValue, true) + } else { this.markSearchNode(sample, this.searchValue, false); - this.resetNewAllNode(sample); } + this.resetNewAllNode(sample); } } @@ -1132,6 +1139,8 @@ export class ProcedureLogicWorkerPerf extends LogicHandler { if (search === '') { sample.searchShow = true; sample.isSearch = false; + sample.hiddenArray = []; + sample.isRemark = false; } else { let isInclude = sample.symbol.toLocaleLowerCase().includes(search); if ((sample.symbol && isInclude) || parentSearch) { @@ -1154,6 +1163,100 @@ export class ProcedureLogicWorkerPerf extends LogicHandler { } } } + + reMarkSearchNode(sampleArray: PerfCallChainMerageData[], search: string, parentSearch: boolean): void { + for (const sample of sampleArray) { + if (search === '') { + sample.searchShow = true; + sample.isRemark = false; + } else { + // 反选符合要求的 + let isInclude = !sample.symbol.toLocaleLowerCase().includes(search); + if (!parentSearch) { + sample.searchShow = false + } else { + if (sample.symbol && isInclude) { + sample.isRemark = true; + sample.searchShow = true; + } else { + sample.isSearch = false; + sample.searchShow = false; + let parentNode = sample.parent + parentNode?.hiddenArray.push(sample.symbolName); + while (parentNode && parentNode.children.length === parentNode.hiddenArray.length) { + parentNode.searchShow = false; + if (parentNode.parent?.hiddenArray.indexOf(parentNode.symbolName) === -1) { + parentNode.parent?.hiddenArray.push(parentNode.symbolName) + } + parentNode = parentNode.parent; + } + } + } + } + const children = this.isOnlyKernel ? sample.initChildren : sample.children; + if (children.length > 0) { + this.reMarkSearchNode(children, search, sample.searchShow); + } + } + } + + markUnRegexSearchNode(sampleArray: PerfCallChainMerageData[], reg: string, parentSearch: boolean): void { + let regex = RegExp(reg); + for (const sample of sampleArray) { + // 反选符合要求的 + let isInclude = regex.test(sample.symbol.toLocaleLowerCase()); + if (!parentSearch) { + sample.searchShow = false + } else { + if (sample.symbol && isInclude) { + sample.isRemark = true; + sample.searchShow = true; + } else { + sample.isSearch = false; + sample.searchShow = false; + let parentNode = sample.parent + parentNode?.hiddenArray.push(sample.symbolName); + while (parentNode && parentNode.children.length === parentNode.hiddenArray.length) { + parentNode.searchShow = false; + if (parentNode.parent?.hiddenArray.indexOf(parentNode.symbolName) === -1) { + parentNode.parent?.hiddenArray.push(parentNode.symbolName) + } + parentNode = parentNode.parent; + } + } + } + const children = this.isOnlyKernel ? sample.initChildren : sample.children; + if (children.length > 0) { + this.markUnRegexSearchNode(children, reg, sample.searchShow); + } + } + } + + markRegexSearchNode(sampleArray: PerfCallChainMerageData[], reg: string, parentSearch: boolean): void { + let regex = RegExp(reg); + for (const sample of sampleArray) { + let isInclude = regex.test(sample.symbol.toLocaleLowerCase()); + if ((sample.symbol && isInclude) || parentSearch) { + sample.searchShow = true; + sample.isSearch = sample.symbol !== undefined && isInclude; + let parentNode = sample.parent; + // 如果匹配,所有parent都显示 + while (parentNode !== undefined && !parentNode.searchShow) { + parentNode.searchShow = true; + parentNode = parentNode.parent; + } + } else { + sample.searchShow = false; + sample.isSearch = false; + } + + const children = this.isOnlyKernel ? sample.initChildren : sample.children; + if (children.length > 0) { + this.markRegexSearchNode(children, reg, sample.searchShow); + } + } + } + splitAllProcess(processArray: { select: string; name: string; type: string; checked: boolean }[]): void { processArray.forEach((item: { select: string; name: string; type: string; checked: boolean }): void => { this.allProcess.forEach((process): void => { @@ -1609,6 +1712,8 @@ export class PerfCallChainMerageData extends ChartStruct { searchShow: boolean = true; isSearch: boolean = false; isState: boolean = false; + isRemark: boolean = false; + hiddenArray: Array = []; set parentNode(data: PerfCallChainMerageData | undefined) { this.parent = data; this.#parentNode = data; diff --git a/ide/src/trace/database/sql/ProcessThread.sql.ts b/ide/src/trace/database/sql/ProcessThread.sql.ts index 40812eabcd581095c5449614afd4951ccdc4aa81..4bc320c22a76806f052853dcbe57b5c7b327458d 100644 --- a/ide/src/trace/database/sql/ProcessThread.sql.ts +++ b/ide/src/trace/database/sql/ProcessThread.sql.ts @@ -1420,28 +1420,28 @@ export const queryRunningThread = ( query( 'getTabThread', ` - select - P.pid, - T.tid, - S.itid, - S.ts, - P.name AS pName, - S.dur + S.ts as endTs - from - sched_slice AS S - left join - process P on S.ipid = P.ipid - left join - thread T on S.itid = T.itid - where - T.tid in (${tIds.join(',')}) - and - P.pid in (${pIds.join(',')}) - and - not ((S.ts + ifnull(S.dur,0) < $leftStartNs) or (S.ts > $rightEndNs)) - order by - S.ts; - `, + select + P.pid, + T.tid, + S.itid, + S.ts, + P.name AS pName, + ifnull(S.dur,0) + S.ts as endTs + from + sched_slice AS S + left join + process P on S.ipid = P.ipid + left join + thread T on S.itid = T.itid + where + T.tid in (${tIds.join(',')}) + and + P.pid in (${pIds.join(',')}) + and + not ((S.ts + ifnull(S.dur,0) < $leftStartNs) or (S.ts > $rightEndNs)) + order by + S.ts; + `, { $leftStartNs: leftStartNs, $rightEndNs: rightEndNs } ); @@ -1455,30 +1455,30 @@ export const queryCoreRunningThread = ( query( 'getTabThread', ` - select - P.pid, - T.tid, - S.cpu, - S.itid, - S.ts, - P.name AS pName, - S.dur + S.ts as endTs - from - sched_slice AS S - left join - process P on S.ipid = P.ipid - left join - thread T on S.itid = T.itid - where - T.tid in (${tIds.join(',')}) - and - P.pid in (${pIds.join(',')}) - and - S.cpu in (${cpu.join(',')}) - and - not ((S.ts + ifnull(S.dur,0) < $leftStartNs) or (S.ts > $rightEndNs)) - order by - S.ts; - `, + select + P.pid, + T.tid, + S.cpu, + S.itid, + S.ts, + P.name AS pName, + ifnull(S.dur,0) + S.ts as endTs + from + sched_slice AS S + left join + process P on S.ipid = P.ipid + left join + thread T on S.itid = T.itid + where + T.tid in (${tIds.join(',')}) + and + P.pid in (${pIds.join(',')}) + and + S.cpu in (${cpu.join(',')}) + and + not ((S.ts + ifnull(S.dur,0) < $leftStartNs) or (S.ts > $rightEndNs)) + order by + S.ts; + `, { $leftStartNs: leftStartNs, $rightEndNs: rightEndNs } ); diff --git a/ide/src/trace/database/ui-worker/ProcedureWorkerAppStartup.ts b/ide/src/trace/database/ui-worker/ProcedureWorkerAppStartup.ts index 73b0d940dab7b91f43ffdc64985c14c1ed7b2545..8bf226bebbdfb28e39a44af5e35ffd391df40986 100644 --- a/ide/src/trace/database/ui-worker/ProcedureWorkerAppStartup.ts +++ b/ide/src/trace/database/ui-worker/ProcedureWorkerAppStartup.ts @@ -109,6 +109,7 @@ export class AppStartupStruct extends BaseStruct { stepName: string | undefined; StartSlice: string | undefined; EndSlice: string | undefined; + endstartTs: number | undefined; static draw(ctx: CanvasRenderingContext2D, data: AppStartupStruct): void { if (data.frame) {