diff --git a/ide/src/base-ui/like/LitLike.ts b/ide/src/base-ui/like/LitLike.ts index c2aa73de6eec73dd22df49d9e4d1ecb652342427..ad774488adaf296ed6935d1827cddcb3580efdcb 100644 --- a/ide/src/base-ui/like/LitLike.ts +++ b/ide/src/base-ui/like/LitLike.ts @@ -14,7 +14,7 @@ */ import { BaseElement, element } from '../BaseElement'; -import { SpStatisticsHttpUtil } from '../../statistics/util/SpStatisticsHttpUtil' +import { SpStatisticsHttpUtil } from '../../statistics/util/SpStatisticsHttpUtil'; @element('lit-like') export class LitLike extends BaseElement { @@ -54,25 +54,25 @@ export class LitLike extends BaseElement { if (!this.isFeedBacked) { this.likeEl!.style.backgroundImage = 'url("img/like-active.png")'; let secondCat = this.type === 'chat' ? 'user_feedback' : 'feedback_good'; - let thirdCat = this.type === 'chat' ? [1] : [this.content]; + let thirdCat = this.type === 'chat' ? ['1'] : [this.content]; SpStatisticsHttpUtil.generalRecord('AI_statistic', secondCat, thirdCat); this.isFeedBacked = true; } else { return; } - }) + }); this.dislikeEl?.addEventListener('click', (e) => { if (!this.isFeedBacked) { this.dislikeEl!.style.backgroundImage = 'url("img/dislike-active.png")'; let secondCat = this.type === 'chat' ? 'user_feedback' : 'feedback_bad'; - let thirdCat = this.type === 'chat' ? [0] : [this.content]; + let thirdCat = this.type === 'chat' ? ['0'] : [this.content]; SpStatisticsHttpUtil.generalRecord('AI_statistic', secondCat, thirdCat); - this.isFeedBacked = true + this.isFeedBacked = true; } else { return; } - }) + }); } diff --git a/ide/src/doc/quickstart_extensions.html b/ide/src/doc/quickstart_extensions.html index 96a788333101dc4d5d07dc6ce2971f5895d4dffd..647ab76b2e0d33902b20a73e346befa42ef7b857 100644 --- a/ide/src/doc/quickstart_extensions.html +++ b/ide/src/doc/quickstart_extensions.html @@ -811,7 +811,7 @@ 在hi-smart-perf-host-extend目录下,找到stop.bat文件,右键选择以管理员身份运行,即可关闭扩展服务。

- 备注:当前扩展服务版本为1.0.0,如果本地存在以其他方式安装的非正式版本,请手动关闭扩展服务,并重新按照该指导安装 + 备注:当前扩展服务版本为1.0.1,如果本地存在以其他方式安装的非正式版本,请手动关闭扩展服务,并重新按照该指导安装

diff --git a/ide/src/statistics/util/SpStatisticsHttpBean.ts b/ide/src/statistics/util/SpStatisticsHttpBean.ts index 927eff7072fdbba394f70a10a8976373bdcdee39..a01cd864b2ce0a7a8755354749b51c26e915481e 100644 --- a/ide/src/statistics/util/SpStatisticsHttpBean.ts +++ b/ide/src/statistics/util/SpStatisticsHttpBean.ts @@ -43,5 +43,5 @@ export interface GeneralRecordRequest { 'feedback_good,feedback_bad':诊断反馈 */ secondCat: string, - thirdCat: Array + thirdCat: Array } diff --git a/ide/src/statistics/util/SpStatisticsHttpUtil.ts b/ide/src/statistics/util/SpStatisticsHttpUtil.ts index 302e56c4d1fcb6beb4a7d5cbddf6dc4b8f3eda3e..42ba45b94f645345d61879b14bee50811245a61f 100644 --- a/ide/src/statistics/util/SpStatisticsHttpUtil.ts +++ b/ide/src/statistics/util/SpStatisticsHttpUtil.ts @@ -169,7 +169,7 @@ export class SpStatisticsHttpUtil { } // ai问答 - static generalRecord(category: string, secondCat: string, thirdCat: Array): void { + static generalRecord(category: string, secondCat: string, thirdCat: Array): void { let requestBody: GeneralRecordRequest = { ts: SpStatisticsHttpUtil.getCorrectRequestTime(), category, @@ -218,9 +218,9 @@ export class SpStatisticsHttpUtil { } // ai对话接口--获取token - static async getAItoken(): Promise { + static async getAItoken(): Promise { let controller = new AbortController(); - let response: aiResponse = { + let response: AiResponse = { status: 0, data: '' }; @@ -248,14 +248,14 @@ export class SpStatisticsHttpUtil { // ai对话接口--问答 // @ts-ignore - static askAi(requestBody): Promise { + static askAi(requestBody): Promise { return new Promise((resolve, reject) => { let controller = new AbortController(); let date = Date.now(); if (!SpStatisticsHttpUtil.controllersMap.has(date)) { - SpStatisticsHttpUtil.controllersMap.set(date, controller) + SpStatisticsHttpUtil.controllersMap.set(date, controller); } - let response: aiResponse = { + let response: AiResponse = { status: 0, data: '', time: date, @@ -288,13 +288,13 @@ export class SpStatisticsHttpUtil { } else { response.data = '请求错误'; } - reject(response) + reject(response); }) }) } } -export class aiResponse { +export class AiResponse { status: number = 0; data: string = ''; time?: number = 0; diff --git a/ide/src/trace/SpApplication.ts b/ide/src/trace/SpApplication.ts index 46670a6aa9efe7b5417bcbfb4a80232674a23e5b..62e1e7d2cb93e7c789f1a75184924715bc0a8655 100644 --- a/ide/src/trace/SpApplication.ts +++ b/ide/src/trace/SpApplication.ts @@ -1990,7 +1990,7 @@ export class SpApplication extends BaseElement { let aiAnalysis = this.shadowRoot ?.querySelector('lit-main-menu')! - .shadowRoot!.querySelector('.ai_analysis') as HTMLDivElement + .shadowRoot!.querySelector('.ai_analysis') as HTMLDivElement; aiAnalysis!.addEventListener('click', (ev) => { if (this.spAiAnalysisPage!.style.visibility === 'hidden' || this.spAiAnalysisPage!.style.display === 'none') { this.spAiAnalysisPage!.style.display = 'block'; @@ -2001,9 +2001,9 @@ export class SpApplication extends BaseElement { } }) - this.spAiAnalysisPage!.valueChangeHandler = (value: string, id: number) => { + this.spAiAnalysisPage!.valueChangeHandler = (value: string, id: number): void => { this.litSearch!.valueChangeHandler!(this.litSearch!.trimSideSpace(value), id); - } + }; // 鼠标拖动改变大小 this.aiPageResize(); @@ -2099,8 +2099,8 @@ export class SpApplication extends BaseElement { if (id > -1) { this.litSearch!.list = this.litSearch!.list.filter((v: unknown) => { // @ts-ignore - return v.id === id - }) + return v.id === id; + }); } this.litSearch!.index = this.spSystemTrace!.showStruct(false, -1, this.litSearch!.list); } @@ -2539,7 +2539,7 @@ export class SpApplication extends BaseElement { headers.append('Content-type', 'application/octet-stream'); headers.append('Content-Transfer-Encoding', 'binary'); return cache.put(`${fileName}`, new Response(reqBufferDB, { status: 200 })); - }) + }); }, 'download-db' ); diff --git a/ide/src/trace/bean/BoxSelection.ts b/ide/src/trace/bean/BoxSelection.ts index b741942a6df46a0983758cc52e5ef8d88d7d0217..c0509abc106216a806db6d59b903ae373f794ada 100644 --- a/ide/src/trace/bean/BoxSelection.ts +++ b/ide/src/trace/bean/BoxSelection.ts @@ -1161,7 +1161,7 @@ export class SelectionParam { item.rangeSelect = true; item.checkType = '2'; this.xpowerMapData.set(item.rowId || '', item.getCacheData); - }) + }); }); } if (it.rowType === TraceRow.ROW_TYPE_XPOWER_SYSTEM_GROUP) { diff --git a/ide/src/trace/component/SpAiAnalysisPage.ts b/ide/src/trace/component/SpAiAnalysisPage.ts index 9260c032ffcc34fbaf401d675809ebb8b574e86b..ee8c489955fbb2f698b208c090fbf8c5e67f72ce 100644 --- a/ide/src/trace/component/SpAiAnalysisPage.ts +++ b/ide/src/trace/component/SpAiAnalysisPage.ts @@ -14,7 +14,7 @@ */ import { BaseElement, element } from '../../base-ui/BaseElement'; -import { aiResponse, SpStatisticsHttpUtil } from '../../statistics/util/SpStatisticsHttpUtil'; +import { AiResponse, SpStatisticsHttpUtil } from '../../statistics/util/SpStatisticsHttpUtil'; import { threadPool } from '../database/SqlLite'; import { SpAiAnalysisPageHtml } from './SpAiAnalysisPage.html'; import { getTimeString } from './trace/sheet/TabPaneCurrentSelection'; @@ -64,6 +64,7 @@ export class SpAiAnalysisPage extends BaseElement { private isResultBack: boolean = true; static startTime: number = 0; static endTime: number = 0; + activeTime: Element | undefined | null; // 监听选中时间范围变化 static selectChangeListener(startTime: number, endTime: number): void { SpAiAnalysisPage.startTime = startTime; @@ -78,9 +79,9 @@ export class SpAiAnalysisPage extends BaseElement { html: true, typographer: true }); - let aiAssistant = document.querySelector("body > sp-application")!.shadowRoot!.querySelector("#sp-ai-analysis"); + let aiAssistant = document.querySelector('body > sp-application')!.shadowRoot!.querySelector('#sp-ai-analysis'); let chatBar = this.shadowRoot?.querySelector('.chatBar'); - let closeBtn = document.querySelector("body > sp-application")!.shadowRoot!.querySelector("#sp-ai-analysis")!.shadowRoot!.querySelector("div.rightTabBar > lit-icon")!.shadowRoot!.querySelector("#icon"); + let closeBtn = document.querySelector('body > sp-application')!.shadowRoot!.querySelector('#sp-ai-analysis')!.shadowRoot!.querySelector('div.rightTabBar > lit-icon')!.shadowRoot!.querySelector('#icon'); this.askQuestion = this.shadowRoot?.querySelector('.ask_question'); this.reportBar = this.shadowRoot?.querySelector('.report'); this.q_a_window = this.shadowRoot?.querySelector('.q_a_window'); @@ -91,7 +92,7 @@ export class SpAiAnalysisPage extends BaseElement { this.chatImg = this.shadowRoot?.querySelector('.chatBar')?.getElementsByTagName('img')[0]; this.reportImg = this.shadowRoot?.querySelector('.report')?.getElementsByTagName('img')[0]; this.sendImg = document.querySelector('body > sp-application')!.shadowRoot!.querySelector('#sp-ai-analysis')!.shadowRoot?.querySelector('div.chatInputBox > div.chatInput > img'); - this.newChatEl = document.querySelector("body > sp-application")!.shadowRoot!.querySelector("#sp-ai-analysis")!.shadowRoot?.querySelector("div.chatBox > div > div.ask_question > div.chatInputBox > div.chatConfig > div > div.newChat > img"); + this.newChatEl = document.querySelector('body > sp-application')!.shadowRoot!.querySelector('#sp-ai-analysis')!.shadowRoot?.querySelector('div.chatBox > div > div.ask_question > div.chatInputBox > div.chatConfig > div > div.newChat > img'); // 诊断按钮 this.draftBtn = this.shadowRoot?.querySelector('.analysisBtn'); // 下载报告按钮 @@ -145,6 +146,7 @@ export class SpAiAnalysisPage extends BaseElement { this.sendMessage(); // 禁止默认的回车换行 e.preventDefault(); + e.stopPropagation(); }; }; }); @@ -190,7 +192,7 @@ export class SpAiAnalysisPage extends BaseElement { this.tipsContent!.style.display = 'flex'; let guideSrc = `https://${window.location.host.split(':')[0]}:${window.location.port }/application/?action=help_27`; - let linkNodeTips = `未连接,请启动本地扩展程序再试![指导]`; + let linkNodeTips = `未连接,请启动本地扩展程序再试![指导]`; this.abnormalPageTips(linkNodeTips, '', 4000); return; } @@ -259,8 +261,9 @@ export class SpAiAnalysisPage extends BaseElement { this.contentsTable!.addEventListener('row-click', (evt) => { // @ts-ignore let index = evt.detail.id; - let targets: any = this.draftList?.querySelectorAll('.title'); + let targets: unknown = this.draftList?.querySelectorAll('.title'); // 目录的(index - 1)对应诊断返回的问题数组下标 + // @ts-ignore let target = targets[index - 1]; if (target) { // 改变滚动条滚动高度,实现点击目录跳转到对应问题 @@ -278,7 +281,7 @@ export class SpAiAnalysisPage extends BaseElement { let loadingItem = document.createElement('div'); loadingItem.className = 'loadingItem'; loadingItem!.appendChild(loadingDiv); - return loadingItem + return loadingItem; } // 重新导trace、db时,初始化诊断功能 @@ -418,25 +421,29 @@ export class SpAiAnalysisPage extends BaseElement { titleDiv.appendChild(topUp); topUp.addEventListener('click', (e) => { this.shadowRoot!.querySelector('.analysisList')!.scrollTop = 0; - }) + }); // 生成类型 let typeDiv = document.createElement('div'); typeDiv.className = 'item'; // @ts-ignore - typeDiv.innerHTML = `问题类型:${dataList[i].type}` + typeDiv.innerHTML = `问题类型:${dataList[i].type}`; // 生成时间 let timeDiv = document.createElement('div'); timeDiv.className = 'item two timeDiv'; timeDiv!.innerHTML = `发生时间:`; let timeList = new Array(); // @ts-ignore - dataList[i].trace_info.forEach((v: any, index: number) => { + dataList[i].trace_info.forEach((v: unknown, index: number) => { let timeSpan = document.createElement('span'); + // @ts-ignore timeSpan.id = v.id; timeSpan.className = 'timeItem'; + // @ts-ignore timeSpan.setAttribute('name', v.name); - timeSpan.innerHTML = `[${v.ts! / 1000000000}s] ,`; + // @ts-ignore + timeSpan.innerHTML = `[${v.ts! / 1000000000}s]${index !== dataList[i].trace_info.length - 1 ? ' ,' : ''}`; timeDiv.appendChild(timeSpan); + // @ts-ignore timeList.push(v.ts! / 1000000000 + 's'); }); // 生成问题原因 @@ -473,13 +480,13 @@ export class SpAiAnalysisPage extends BaseElement { this.contentsTable!.recycleDataSource = []; this.contentsTable!.style.display = 'block'; // 修改Tbl样式 - let th = this.contentsTable!.shadowRoot!.querySelector("div.table > div.thead > div")! as HTMLElement; + let th = this.contentsTable!.shadowRoot!.querySelector('div.table > div.thead > div')! as HTMLElement; th.style.backgroundColor = '#8bbcdff7'; // @ts-ignore let source = dataList.map((item: unknown, index: number) => { // @ts-ignore - return { ...item, id: index + 1 } - }) + return { ...item, id: index + 1 }; + }); this.contentsTable!.recycleDataSource = source; } @@ -489,7 +496,7 @@ export class SpAiAnalysisPage extends BaseElement { tbody.style.height = TBODY_HEIGHT + 'px'; } - async getToken(isChat?: boolean) { + async getToken(isChat?: boolean): Promise { let data = await SpStatisticsHttpUtil.getAItoken(); if (data.status !== 200) { if (isChat) { @@ -530,7 +537,7 @@ export class SpAiAnalysisPage extends BaseElement { } // 每90min重新获取token - async getToken90Min(isChat: boolean) { + async getToken90Min(isChat: boolean): Promise { await this.getToken(isChat); await setInterval(async () => { await this.getToken(isChat); @@ -538,25 +545,32 @@ export class SpAiAnalysisPage extends BaseElement { } // 发送请求获取优化建议并渲染页面 - getSuggestion(dataList: unknown, i: number, itemDiv: HTMLDivElement | null | undefined, suggestonDiv: HTMLDivElement | null | undefined, timeList: Array): void { + getSuggestion( + dataList: unknown, + i: number, + itemDiv: HTMLDivElement | null | undefined, + suggestonDiv: HTMLDivElement | null | undefined, + timeList: Array + ): void { SpStatisticsHttpUtil.askAi({ - token: this.token,// @ts-ignore + token: this.token, + // @ts-ignore question: dataList[i].description + ',请问该怎么优化?', collection: '' }).then((suggestion) => { this.appendMsg(dataList, i, suggestonDiv, timeList, suggestion); }).catch((error) => { this.appendMsg(dataList, i, suggestonDiv, timeList, error); - }) + }); this.draftList!.appendChild(itemDiv!); itemDiv!.style.animation = 'opcityliner 3s'; } // 优化建议msg处理并渲染 - appendMsg(dataList: unknown, i: number, suggestonDiv: HTMLDivElement | null | undefined, timeList: Array, suggestion: aiResponse) { + appendMsg(dataList: unknown, i: number, suggestonDiv: HTMLDivElement | null | undefined, timeList: Array, suggestion: AiResponse): void { // 保证controllersMap里面存的是未完成的请求,并规避重新打开trace时异步msg未请求完毕引入的问题 if (SpStatisticsHttpUtil.controllersMap.has(suggestion.time!)) { - SpStatisticsHttpUtil.controllersMap.delete(suggestion.time!); + SpStatisticsHttpUtil.controllersMap.delete(suggestion.time!); } if (SpStatisticsHttpUtil.isInterrupt) { if (SpStatisticsHttpUtil.controllersMap.size === 0) { @@ -585,7 +599,7 @@ export class SpAiAnalysisPage extends BaseElement { } // 取消或中断请求 - breakRequest() { + breakRequest(): void { for (const controller of SpStatisticsHttpUtil.controllersMap.values()) { controller.abort(); } @@ -646,7 +660,7 @@ export class SpAiAnalysisPage extends BaseElement { if (this.isJsonString(jsonRes.resultMessage)) { let dataList = JSON.parse(jsonRes.resultMessage) || []; if (dataList && dataList.length === 0) { - SpStatisticsHttpUtil.generalRecord('AI_statistic', 'large_model_detect', [0]) + SpStatisticsHttpUtil.generalRecord('AI_statistic', 'large_model_detect', ['0']); this.isNodata = true; this.draftList!.innerHTML = ''; this.contentsTable!.style.display = 'none'; @@ -656,7 +670,7 @@ export class SpAiAnalysisPage extends BaseElement { this.abnormalPageTips(textStr, imgsrc, 0); this.draftBtn!.style.display = 'inline-block'; } else { - SpStatisticsHttpUtil.generalRecord('AI_statistic', 'large_model_detect', [1]); + SpStatisticsHttpUtil.generalRecord('AI_statistic', 'large_model_detect', ['1']); this.isNodata = false; // 整理数据,渲染数据 await this.renderData(dataList); @@ -677,28 +691,26 @@ export class SpAiAnalysisPage extends BaseElement { } // 点击时间跳转 - timeClickHandler(timeDiv: HTMLDivElement) { + timeClickHandler(timeDiv: HTMLDivElement): void { let timeElementList = timeDiv!.getElementsByClassName('timeItem'); for (let i = 0; i < timeElementList.length; i++) { timeElementList[i].addEventListener('click', (e) => { + if (this.activeTime) { + this.activeTime.removeAttribute('active'); + } + this.activeTime = timeElementList[i].getElementsByClassName('timeText')[0]; // 点击项更换颜色 - timeElementList[i].getElementsByClassName('timeText')[0].setAttribute('active', '') + this.activeTime.setAttribute('active', ''); let name = timeElementList[i].getAttribute('name'); let id = Number(timeElementList[i].getAttribute('id')); - // 其他项重置颜色 - for (let j = 0; j < timeElementList.length; j++) { - if (i !== j) { - timeElementList[j].getElementsByClassName('timeText')[0].removeAttribute('active'); - } - } // @ts-ignore this.valueChangeHandler!(name, id); - }) + }); } } // 判断是否为json - isJsonString(str: string) { + isJsonString(str: string): boolean { try { JSON.parse(str); } catch (e) { diff --git a/ide/src/trace/component/SpSystemTrace.event.ts b/ide/src/trace/component/SpSystemTrace.event.ts index 23e16b713eec7ff206f7cbfd43343e3e4dd20aba..60d590885880114f545c48289fcae3e1a4efb754 100644 --- a/ide/src/trace/component/SpSystemTrace.event.ts +++ b/ide/src/trace/component/SpSystemTrace.event.ts @@ -608,7 +608,7 @@ export function spSystemTraceDocumentOnMouseOut(sp: SpSystemTrace, ev: MouseEven CpuStruct.hoverCpuStruct = undefined; TraceRow.isUserInteraction = false; SpSystemTrace.isMouseLeftDown = false; - if(!sp.keyboardEnable){ + if (!sp.keyboardEnable) { return; } if (sp.isMouseInSheet(ev)) { @@ -810,7 +810,7 @@ export function spSystemTraceDocumentOnKeyUp(sp: SpSystemTrace, ev: KeyboardEven clearTimeout(timerId); } } - if(!sp.keyboardEnable){ + if (!sp.keyboardEnable) { return; } let flag: boolean = sp.parentElement diff --git a/ide/src/trace/component/SpSystemTrace.init.ts b/ide/src/trace/component/SpSystemTrace.init.ts index 3ccb9bc579a9336315f90f13823773278a3665ac..2e2ba61f6fe9e442291c9880058ab392e261f366 100644 --- a/ide/src/trace/component/SpSystemTrace.init.ts +++ b/ide/src/trace/component/SpSystemTrace.init.ts @@ -46,7 +46,7 @@ const pluginArray = [ 'animation', 'app_startup', 'args', 'callstack', 'clk_event_filter', 'clock_event_filter', 'cpu_measure_filter', 'device_info', 'dynamic_frame', 'frame_maps', 'frame_slice', 'gpu_slice', 'instant', 'irq', 'process_measure_filter', 'process_measure', - 'sched_slice', 'static_initalize', 'symbols', 'syscall', 'task_pool', 'thread_state','dma_fence' + 'sched_slice', 'static_initalize', 'symbols', 'syscall', 'task_pool', 'thread_state', 'dma_fence' ] }, { @@ -65,13 +65,13 @@ const pluginArray = [ pluginName: 'arkTs-plugin', tables: [ 'js_config', 'js_cpu_profiler_node', 'js_cpu_profiler_sample', 'js_heap_files', 'js_heap_info', 'js_heap_location', - 'js_heap_nodes', 'js_heap_sample', 'js_heap_string', 'js_heap_trace_function_info', 'js_heap_trace_node','js_heap_edges' + 'js_heap_nodes', 'js_heap_sample', 'js_heap_string', 'js_heap_trace_function_info', 'js_heap_trace_node', 'js_heap_edges' ] }, { pluginName: 'memory-plugin', tables: [ - 'memory_ashmem', 'memory_cpu', 'memory_dma', 'memory_process_gpu', 'memory_profile,', 'memory_rs_image', 'memory_window_gpu','smaps','sys_event_filter','sys_mem_measure' + 'memory_ashmem', 'memory_cpu', 'memory_dma', 'memory_process_gpu', 'memory_profile,', 'memory_rs_image', 'memory_window_gpu', 'smaps', 'sys_event_filter', 'sys_mem_measure' ] }, { @@ -128,7 +128,7 @@ const pluginArray = [ 'xpower_measure' ] } -] +]; function rightButtonOnClick(sp: SpSystemTrace, rightStar: HTMLElementAlias): unknown { Object.assign(sp, { @@ -624,7 +624,7 @@ function selectHandler(sp: SpSystemTrace): void { ...sp.favoriteChartListEL!.getAllSelectCollectRows(), ]; } - checkRows = checkRows.filter((item, index, self) => { //去重 + checkRows = checkRows.filter((item, index, self) => { return self.findIndex(obj => obj.rowId === item.rowId && obj.rowType === item.rowType && obj.name === item.name) === index; }); selectHandlerRefreshCheckBox(sp, checkRows, refreshCheckBox); @@ -950,7 +950,7 @@ export function cancelCurrentTraceRowHighlight(sp: SpSystemTrace, currentEntry: } }); if (!filterRow) { - let rowsPaneEL = document.querySelector("body > sp-application")?.shadowRoot?.querySelector("#sp-system-trace")?.shadowRoot?.querySelector("div > div.rows-pane") + let rowsPaneEL = document.querySelector('body > sp-application')?.shadowRoot?.querySelector('#sp-system-trace')?.shadowRoot?.querySelector('div > div.rows-pane'); // @ts-ignore let funcRow = rowsPaneEL?.querySelector>(`trace-row[row-id='${funcRowID}'][row-type='func']`); if (funcRow) { @@ -1277,7 +1277,7 @@ export async function spSystemTraceInit( for (let i = 0; i < pluginArray.length; i++) { let item = pluginArray[i]; for (let j = 0; j < item.tables.length; j++) { - let tableItem = item.tables[j] + let tableItem = item.tables[j]; let res = await queryPlugins(tableItem) || []; if (res.length > 0) { SpStatisticsHttpUtil.recordPlugin.push(item.pluginName); diff --git a/ide/src/trace/component/SpSystemTrace.line.ts b/ide/src/trace/component/SpSystemTrace.line.ts index 7bcc1e0c9d91851d378797fc6d61018c57bdc85d..4df45dc159e5416c846c1dbfbbfb9f8f68cb1687 100644 --- a/ide/src/trace/component/SpSystemTrace.line.ts +++ b/ide/src/trace/component/SpSystemTrace.line.ts @@ -689,7 +689,7 @@ function jankPoint( let ts: number = 0; if (findJankEntry) { ts = selectThreadStruct.startTime! + selectThreadStruct.dur! / 2; - const [startY, startRowEl, startOffSetY] = sp.calculateStartY(startRow, selectThreadStruct.pid,selectThreadStruct.tid); + const [startY, startRowEl, startOffSetY] = sp.calculateStartY(startRow, selectThreadStruct.pid, selectThreadStruct.tid); const [endY, endRowEl, endOffSetY] = sp.calculateEndY(endParentRow, endRowStruct); sp.addPointPair( sp.makePoint( diff --git a/ide/src/trace/component/chart/FrameChart.ts b/ide/src/trace/component/chart/FrameChart.ts index 3171047e4b1c9c734a99e1f6c7a8ecae695e3787..69a5613bee19efc83ab85bb4349a2aec6e424d06 100644 --- a/ide/src/trace/component/chart/FrameChart.ts +++ b/ide/src/trace/component/chart/FrameChart.ts @@ -79,7 +79,7 @@ export class FrameChart extends BaseElement { } set data(val: Array) { - this.tabPaneFilter = document.querySelector("body > sp-application")?.shadowRoot?.querySelector("#sp-system-trace")?.shadowRoot?.querySelector("div > trace-sheet")?.shadowRoot?.querySelector("#box-native-calltree > tabpane-nm-calltree")?.shadowRoot?.querySelector("#nm-call-tree-filter") as TabPaneFilter; + this.tabPaneFilter = document.querySelector('body > sp-application')?.shadowRoot?.querySelector('#sp-system-trace')?.shadowRoot?.querySelector('div > trace-sheet')?.shadowRoot?.querySelector('#box-native-calltree > tabpane-nm-calltree')?.shadowRoot?.querySelector("#nm-call-tree-filter") as TabPaneFilter; ChartStruct.lastSelectFuncStruct = undefined; this.setSelectStatusRecursive(ChartStruct.selectFuncStruct, true); ChartStruct.selectFuncStruct = undefined; diff --git a/ide/src/trace/component/chart/SpChartManager.ts b/ide/src/trace/component/chart/SpChartManager.ts index 9adf92fdfcc28cfff8a43c8e3d840d8a4c141ace..9ed895e549f6e8da77a87721a6404a7767423a60 100644 --- a/ide/src/trace/component/chart/SpChartManager.ts +++ b/ide/src/trace/component/chart/SpChartManager.ts @@ -168,7 +168,6 @@ export class SpChartManager { } if (FlagsConfig.getFlagsConfigEnableStatus('UserPluginsRow')) { await this.spUserFileChart.init(null) - await this.spImportUserPluginsChart.init(); } if (FlagsConfig.getFlagsConfigEnableStatus('GpuCounter')) { await this.spGpuCounterChart.init([]); diff --git a/ide/src/trace/component/chart/SpProcessChart.ts b/ide/src/trace/component/chart/SpProcessChart.ts index 11519b54d1bd9ebfd8b7dea2b3fa7fed79540487..925c8d0a337ede10985c14e5d2a3a3386a53a26b 100644 --- a/ide/src/trace/component/chart/SpProcessChart.ts +++ b/ide/src/trace/component/chart/SpProcessChart.ts @@ -742,9 +742,13 @@ export class SpProcessChart { ThreadStruct.selectThreadStruct = selectProcessStruct; //@ts-ignore ThreadStruct.hoverThreadStruct = selectProcessStruct; } - });//@ts-ignore - linkItem[0].backrowEL = linkItem[0].sourcebackrowEL!.parentRowEl?.expansion ? linkItem[0].sourcebackrowEL! : linkItem[0].sourcebackrowEL!.parentRowEl;//@ts-ignore - linkItem[1].backrowEL = linkItem[1].sourcebackrowEL!.parentRowEl?.expansion ? linkItem[1].sourcebackrowEL! : linkItem[1].sourcebackrowEL!.parentRowEl; + }); + //@ts-ignore + linkItem[0].backrowEL = linkItem[0].sourcebackrowEL!.parentRowEl?.expansion ? + linkItem[0].sourcebackrowEL! : linkItem[0].sourcebackrowEL!.parentRowEl; + //@ts-ignore + linkItem[1].backrowEL = linkItem[1].sourcebackrowEL!.parentRowEl?.expansion ? + linkItem[1].sourcebackrowEL! : linkItem[1].sourcebackrowEL!.parentRowEl; if (linkItem[0].rowEL.expansion && linkItem[0].backrowEL) { this.updatePairPointTranslateY(linkItem[0]); linkItem[0].x = ns2xByTimeShaft(linkItem[0].ns, this.trace.timerShaftEL!); @@ -1149,7 +1153,12 @@ export class SpProcessChart { } } - initSameThreadFolder(it: { pid: number | null; processName: string | null }, pRow: TraceRow, list: Array, traceId?: string): TraceRow { + initSameThreadFolder( + it: { pid: number | null; processName: string | null }, + pRow: TraceRow, + list: Array, + traceId?: string + ): TraceRow { let sameThreadRow = TraceRow.skeleton(); sameThreadRow.rowId = 'sameThreadProcess'; sameThreadRow.rowParentId = `${it.pid}`; @@ -1388,7 +1397,7 @@ export class SpProcessChart { ): void { //@ts-ignore if (this.threadFuncMaxDepthMap.get(`${thread.upid}-${thread.tid}`) !== undefined) { - this.addHangRow(process, processRow, threadRow,thread); + this.addHangRow(process, processRow, threadRow, thread); //@ts-ignore let max = this.threadFuncMaxDepthMap.get(`${thread.upid}-${thread.tid}`) || 1; let maxHeight = max * 18 + 6; diff --git a/ide/src/trace/component/trace/SpChartList.ts b/ide/src/trace/component/trace/SpChartList.ts index 6a11b1fce0c1894c9e475a797048f97d409da1a0..b82f62d9be970cd565ee2b253af99041776cb6b5 100644 --- a/ide/src/trace/component/trace/SpChartList.ts +++ b/ide/src/trace/component/trace/SpChartList.ts @@ -71,7 +71,7 @@ export class SpChartList extends BaseElement { private spSystemTrace: SpSystemTrace | undefined | null; initElements(): void { - this.spSystemTrace = document?.querySelector("body > sp-application")?.shadowRoot?.querySelector("#sp-system-trace"); + this.spSystemTrace = document?.querySelector('body > sp-application')?.shadowRoot?.querySelector('#sp-system-trace'); this.collectEl1 = this.shadowRoot?.querySelector('#collect-group-1'); this.collectEl2 = this.shadowRoot?.querySelector('#collect-group-2'); this.groupTitle1 = this.shadowRoot?.querySelector('#group-1-title'); diff --git a/ide/src/trace/component/trace/base/shadowRootInput.ts b/ide/src/trace/component/trace/base/shadowRootInput.ts index 53984ee1702e81ece0bab3057e4c78e9a49c7b6f..c9e4c76e78ddf4444518cbdc769f8a2acfcbbfb4 100644 --- a/ide/src/trace/component/trace/base/shadowRootInput.ts +++ b/ide/src/trace/component/trace/base/shadowRootInput.ts @@ -12,12 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { BaseElement } from "../../../../base-ui/BaseElement"; -import { SpSystemTrace } from "../../SpSystemTrace"; +import { BaseElement } from '../../../../base-ui/BaseElement'; +import { SpSystemTrace } from '../../SpSystemTrace'; export class shadowRootInput { public static preventBubbling(page: BaseElement | Element) { let pageInputList = shadowRootInput.findInputListInShadowDOM(page); - let sp = document?.querySelector("body > sp-application")?.shadowRoot?.querySelector("#sp-system-trace") as SpSystemTrace; + let sp = document?.querySelector('body > sp-application')?.shadowRoot?.querySelector('#sp-system-trace') as SpSystemTrace; pageInputList.forEach(input => { input.addEventListener('focus', (e) => { sp.keyboardEnable = false; @@ -27,7 +27,7 @@ export class shadowRootInput { }); }); } - public static findInputListInShadowDOM(page: BaseElement | Element | null) { + public static findInputListInShadowDOM(page: BaseElement | Element | null): Element[] { let queue: (Element | null)[] = [page]; let inputList: Element[] = []; while (queue.length > 0) { diff --git a/ide/src/trace/component/trace/sheet/TabPaneCurrent.ts b/ide/src/trace/component/trace/sheet/TabPaneCurrent.ts index a9bed5c3ad8957ac130d3f67d78cf12896a6fcae..414e019954bb51418f3ac970fc3b7a17989bd8cb 100644 --- a/ide/src/trace/component/trace/sheet/TabPaneCurrent.ts +++ b/ide/src/trace/component/trace/sheet/TabPaneCurrent.ts @@ -103,7 +103,7 @@ export class TabPaneCurrent extends BaseElement { return; } // @ts-ignore - if((window as unknown).flagInputFocus){ + if ((window as unknown).flagInputFocus) { return; } let tr = this.panelTable!.shadowRoot!.querySelectorAll('.tr') as NodeListOf; diff --git a/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts b/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts index 4792d72257d116b21e0e088de855ff1f55096f82..038b0a29e6a36cc3bfd904fa9ea133048f37431a 100644 --- a/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts +++ b/ide/src/trace/component/trace/sheet/TabPaneCurrentSelection.ts @@ -414,7 +414,7 @@ export class TabPaneCurrentSelection extends BaseElement { } else { this.handleNonBinder(data, list, name, information); } - } else if (data.funName!.startsWith("H:Et") && (data.depth === 1 || data.depth === 0)) { + } else if (data.funName!.startsWith('H:Et') && (data.depth === 1 || data.depth === 0)) { list.push({ name: 'StartTime(Relative)', value: getTimeString(data.startTs || 0), diff --git a/ide/src/trace/component/trace/sheet/cpu/TabPaneFrequencySample.ts b/ide/src/trace/component/trace/sheet/cpu/TabPaneFrequencySample.ts index 98eebd75fc74f319ad124fdb8bb60bed8eb39612..2624391dfdc16fbd417ac696609b6a7cdbeb40af 100644 --- a/ide/src/trace/component/trace/sheet/cpu/TabPaneFrequencySample.ts +++ b/ide/src/trace/component/trace/sheet/cpu/TabPaneFrequencySample.ts @@ -49,9 +49,7 @@ export class TabPaneFrequencySample extends BaseElement { this.selectionParam = frequencySampleValue; if (this.frequencySampleTbl) { // @ts-ignore - this.frequencySampleTbl.shadowRoot.querySelector('.table').style.height = `${ - this.parentElement!.clientHeight - 25 - }px`; + this.frequencySampleTbl.shadowRoot.querySelector('.table').style.height = `${this.parentElement!.clientHeight - 25}px`; } this.queryDataByDB(frequencySampleValue); } @@ -109,7 +107,7 @@ export class TabPaneFrequencySample extends BaseElement { freqFilter[i].value === data.value && // @ts-ignore freqFilter[i].cpu === data.cpu && // @ts-ignore Math.max(TraceRow.rangeSelectObject?.startNS!, freqFilter[i].startNS!) < // @ts-ignore - Math.min(TraceRow.rangeSelectObject?.endNS!, freqFilter[i].startNS! + freqFilter[i].dur!) + Math.min(TraceRow.rangeSelectObject?.endNS!, freqFilter[i].startNS! + freqFilter[i].dur!) ) { // @ts-ignore CpuFreqStruct.hoverCpuFreqStruct = freqFilter[i]; @@ -192,7 +190,6 @@ export class TabPaneFrequencySample extends BaseElement { for (let j = 0; j < weightMapArr.length; j++) { // @ts-ignore let singleCpuArr = tmpCpuArr.filter((item) => item[1].filterId && item[1].filterId === Number(weightMapArr[j][1].filterId)); - // console.log(singleCpuArr); let tmpTotalTime = 0; let tmpTotalCount = 0; for (let i = 0; i < singleCpuArr.length; i++) { @@ -204,7 +201,7 @@ export class TabPaneFrequencySample extends BaseElement { // @ts-ignore let tmpPosition = tmpCpuArr.findIndex(item => item[1].filterId === weightMapArr[j][1].filterId); // @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)))}]); + 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))) }]); }; sampleMap = new Map(tmpCpuArr); sampleMap.forEach((a): void => { @@ -342,10 +339,10 @@ export class TabPaneFrequencySample extends BaseElement { if (this.freqBusyDataList.length > 0) { this.frequencySampleTbl!.recycleDataSource.forEach((value): void => { // @ts-ignore - if(value.counter.includes('( WA )')){ + if (value.counter.includes('( WA )')) { // @ts-ignore - value.busyTimeStr = '-' - }else { + value.busyTimeStr = '-'; + } else { // @ts-ignore value.busyTimeStr = type ? value.busyTime : '-'; } diff --git a/ide/src/trace/component/trace/sheet/hang/TabPaneHang.ts b/ide/src/trace/component/trace/sheet/hang/TabPaneHang.ts index 4dc767a20b8771c73eb494ebfa1addec9dc5e305..3108464859bc7ee4bbd2642aceb48a385b370caa 100644 --- a/ide/src/trace/component/trace/sheet/hang/TabPaneHang.ts +++ b/ide/src/trace/component/trace/sheet/hang/TabPaneHang.ts @@ -280,7 +280,7 @@ export class TabPaneHang extends BaseElement { } else { let arr = Array.from(this.filterData); arr.sort((a, b): number => { - if (key === "startTime") { + if (key === 'startTime') { if (type === 1) { // @ts-ignore return a.startTime - b.startTime; diff --git a/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMStatstics.ts b/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMStatstics.ts index 8b989edc8f927a8e72d7be92031bc13b42624513..212d6bd788ce0d79eaf1e97794542d0aafb752a5 100644 --- a/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMStatstics.ts +++ b/ide/src/trace/component/trace/sheet/native-memory/TabPaneNMStatstics.ts @@ -66,7 +66,7 @@ export class TabPaneNMStatstics extends BaseElement { this.queryData(nativeStatisticsParam); } - async recordEventHeap(ipid: number) { + async recordEventHeap(ipid: number): Promise { SpNativeMemoryChart.EVENT_HEAP = await queryHeapSizeByIpid(ipid); SpNativeMemoryChart.EVENT_HEAP.map((heap) => { this.allMax += heap.sumHeapSize; diff --git a/ide/src/trace/component/trace/sheet/process/TabPaneSlices.ts b/ide/src/trace/component/trace/sheet/process/TabPaneSlices.ts index 2ca0e4998c4f595bf8e7ed198c18d222fdd84441..49509b0b0d2dc5b485a73057b1655775752dd3ba 100644 --- a/ide/src/trace/component/trace/sheet/process/TabPaneSlices.ts +++ b/ide/src/trace/component/trace/sheet/process/TabPaneSlices.ts @@ -32,7 +32,7 @@ export class TabPaneSlices extends BaseElement { private slicesSource: Array = []; private currentSelectionParam: SelectionParam | undefined; private sliceSearchCount: Element | undefined | null; - + private isDbClick: boolean = false; set data(slicesParam: SelectionParam) { if (this.currentSelectionParam === slicesParam) { return; @@ -89,9 +89,12 @@ export class TabPaneSlices extends BaseElement { data = evt.detail.data; }); this.slicesTbl!.addEventListener('click', () => { - FuncStruct.funcSelect = false; + if(!this.isDbClick){ + this.isDbClick = true; + FuncStruct.funcSelect = false; // @ts-ignore data && this.orgnazitionData(data); + } }); this.slicesTbl!.addEventListener('contextmenu', () => { FuncStruct.funcSelect = true; @@ -239,6 +242,7 @@ export class TabPaneSlices extends BaseElement { this.slicesTblFreshSearchSelect(search, sliceRowList, data, spSystemTrace); spSystemTrace?.visibleRows.forEach((it) => { it.draw(); + this.isDbClick = false; }); }); } diff --git a/ide/src/trace/component/trace/timer-shaft/TabPaneFlag.ts b/ide/src/trace/component/trace/timer-shaft/TabPaneFlag.ts index 777db737caa05078673c26fa6174aac31e4fb2f3..ab73e814ae5ac75d0c8302285d27c86f5ea05917 100644 --- a/ide/src/trace/component/trace/timer-shaft/TabPaneFlag.ts +++ b/ide/src/trace/component/trace/timer-shaft/TabPaneFlag.ts @@ -62,7 +62,7 @@ export class TabPaneFlag extends BaseElement { return; } // @ts-ignore - if((window as unknown).flagInputFocus){ + if ((window as unknown).flagInputFocus) { return; } let tr = this.panelTable!.shadowRoot!.querySelectorAll('.tr') as NodeListOf; diff --git a/ide/src/trace/database/ui-worker/ProcedureWorkerXpower.ts b/ide/src/trace/database/ui-worker/ProcedureWorkerXpower.ts index 6bd7bfa3936a180a4ac2e9af930cff8b4afc749d..ef0ac984152bf4c1db794028b7f2108cf2dff9d0 100644 --- a/ide/src/trace/database/ui-worker/ProcedureWorkerXpower.ts +++ b/ide/src/trace/database/ui-worker/ProcedureWorkerXpower.ts @@ -102,7 +102,7 @@ export class XpowerStruct extends BaseStruct { let width = data.frame.width || 0; xpowerContext.fillStyle = ColorUtils.colorForTid(XpowerStruct.index); xpowerContext.strokeStyle = ColorUtils.colorForTid(XpowerStruct.index); - if ((data.value || 0) < 0) { //数据为负数时显示不同颜色 + if ((data.value || 0) < 0) { //数据为负数时显示不同颜色 xpowerContext.fillStyle = ColorUtils.colorForTid(XpowerStruct.index + 6); xpowerContext.strokeStyle = ColorUtils.colorForTid(XpowerStruct.index + 6); } diff --git a/ide/src/trace/database/ui-worker/cpu/ProcedureWorkerCPU.ts b/ide/src/trace/database/ui-worker/cpu/ProcedureWorkerCPU.ts index cfdc6fe9ba3f8cca2b856e85e507131da296cd45..9419ba8e56728ea69682687e42a3f2cd209ce3fc 100644 --- a/ide/src/trace/database/ui-worker/cpu/ProcedureWorkerCPU.ts +++ b/ide/src/trace/database/ui-worker/cpu/ProcedureWorkerCPU.ts @@ -263,15 +263,18 @@ export class CpuStruct extends BaseStruct { let pid = data.processId || 0; let tid = data.tid || 0; let width = data.frame.width || 0; - ctx.globalAlpha = 1; if (data.tid === CpuStruct.hoverCpuStruct?.tid || !CpuStruct.hoverCpuStruct) { + ctx.globalAlpha = 1; ctx.fillStyle = ColorUtils.colorForTid(pid > 0 ? pid : tid); } else if (data.processId === CpuStruct.hoverCpuStruct?.processId) { + ctx.globalAlpha = 0.6; ctx.fillStyle = ColorUtils.colorForTid(pid > 0 ? pid : tid); } else { + ctx.globalAlpha = 1; ctx.fillStyle = '#e0e0e0'; } ctx.fillRect(data.frame.x, data.frame.y, width, data.frame.height); + ctx.globalAlpha = 1; CpuStruct.drawText(ctx, data, width, pid, tid); CpuStruct.drawRim(ctx, data, width); } diff --git a/ide/src/webSocket/WebSocketManager.ts b/ide/src/webSocket/WebSocketManager.ts index c10bdd19cfd9fba3efe0064b223b9fe5a698f48f..cb96890558aee401fc031484e42ecb0a348b4dd7 100644 --- a/ide/src/webSocket/WebSocketManager.ts +++ b/ide/src/webSocket/WebSocketManager.ts @@ -76,7 +76,7 @@ export class WebSocketManager { if (decode.cmd === Constants.GET_CMD) { // 小于则升级 let targetVersion = '1.0.1'; - let currentVersion = new TextDecoder().decode(decode.data) + let currentVersion = new TextDecoder().decode(decode.data); let result = this.compareVersion(currentVersion, targetVersion); if (result === -1) { this.updateVersion(); @@ -101,13 +101,13 @@ export class WebSocketManager { } // get版本 - getVersion() { + getVersion(): void { // 获取扩展程序版本 this.send(TypeConstants.UPDATE_TYPE, Constants.GET_CMD); } //check版本 - compareVersion(currentVersion: string, targetVersion: string) { + compareVersion(currentVersion: string, targetVersion: string): number { // 将版本字符串分割成数组 let parts1 = currentVersion.split('.'); let parts2 = targetVersion.split('.'); @@ -128,7 +128,7 @@ export class WebSocketManager { } // 更新扩展程序 - updateVersion() { + updateVersion(): void { // 扩展程序升级 let url = `https://${window.location.host.split(':')[0]}:${window.location.port }/application/extend/hi-smart-perf-host-extend-update.zip`; @@ -136,12 +136,12 @@ export class WebSocketManager { if (!response.ok) { throw new Error("No corresponding upgrade compression package found"); } - return response.arrayBuffer() + return response.arrayBuffer(); }).then((arrayBuffer) => { this.send(TypeConstants.UPDATE_TYPE, Constants.UPDATE_CMD, new Uint8Array(arrayBuffer)); }).catch((error) => { console.error(error); - }) + }); } // 登录 @@ -182,10 +182,10 @@ export class WebSocketManager { if (!this.ready) {// 改判断条件 ready return; } - this.send(type, cmd, data) + this.send(type, cmd, data); } - send(type: number, cmd?: number, data?: Uint8Array) { + send(type: number, cmd?: number, data?: Uint8Array): void { let message: MessageParam = { type: type, cmd: cmd, diff --git a/ide/webpack.config.js b/ide/webpack.config.js index 553979178bc65a77851d85ba0ad8a829d1dd0071..05f6d5aa481aa1241e1f471a600c888f4b353f4a 100644 --- a/ide/webpack.config.js +++ b/ide/webpack.config.js @@ -86,10 +86,15 @@ function buildMultiPlatform() { const serverSrc = path.normalize(path.join(__dirname, '/server/main.go')); for (const platform of supportPlatform) { const generateFile = platform === 'windows' ? - path.normalize(path.join(outPath, '/', `main.exe`)) : - path.normalize(path.join(outPath, '/', `main_${platform}`)); - const setEnv = `go env -w CGO_ENABLED=0 && go env -w GOOS=${platform} && go env -w GOARCH=amd64`; - const buildCmd = `${setEnv} && go build -o ${generateFile} ${serverSrc}`; + path.normalize(path.join(outPath, '/', `main.exe`)) : + path.normalize(path.join(outPath, '/', `main_${platform}`)); + setEnv = ''; + if (os.type() === "Windows_NT") { + setEnv += `SET CGO_ENABLED=0&&SET GOOS=${platform}&&SET GOARCH=amd64&&`; + } else { + setEnv += `CGO_ENABLED=0 GOOS=${platform} GOARCH=amd64`; + } + const buildCmd = `${setEnv} go build -o ${generateFile} ${serverSrc}`; console.log(`compile ${platform} server ...`); childProcess.execSync(buildCmd); } diff --git a/trace_streamer/gn/toolchain/BUILD.gn b/trace_streamer/gn/toolchain/BUILD.gn index e0e67e31d2b5b4ab7c17c705de4c70b960a2b97c..d7dcc780241b211fd9636314290cb1064e60c015 100644 --- a/trace_streamer/gn/toolchain/BUILD.gn +++ b/trace_streamer/gn/toolchain/BUILD.gn @@ -186,7 +186,13 @@ toolchain("gcc_like") { } tool("link") { - command = "$cxx -o {{output}} {{ldflags}} {{inputs}} {{solibs}} {{libs}}" + if (is_mac) { + command = "$cxx -o {{output}} {{ldflags}} {{inputs}} {{solibs}} {{libs}}" + } else if (is_win) { + command = "$cxx -o {{output}} --static {{ldflags}} {{inputs}} {{solibs}} {{libs}}" + } else { + command = "$cxx -o {{output}} -static-libstdc++ {{ldflags}} {{inputs}} {{solibs}} {{libs}}" + } outputsfiles = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" outputs = [ outputsfiles ] description = "step: link {{output}}" diff --git a/trace_streamer/pare_third_party.sh b/trace_streamer/pare_third_party.sh index 2e2d29e3628d46bd53991b48e9f1e291568f0f50..c069616bd3b5911691d29ca08183ad9b44af0e68 100755 --- a/trace_streamer/pare_third_party.sh +++ b/trace_streamer/pare_third_party.sh @@ -57,7 +57,7 @@ if [ ! -f "bzip2/BUILD.gn" ];then mv third_party_bzip2 bzip2 $cp ../prebuilts/patch_bzip2/bzip2build.gn bzip2/BUILD.gn cd bzip2 - ./install.sh `pwd` + ./install.sh $(pwd) cd .. fi fi diff --git a/trace_streamer/src/base/codec_cov.cpp b/trace_streamer/src/base/codec_cov.cpp index 7ccaaab7cd3b084061bedf938d6b94028c2af889..648c6186ac667a69278cff8dc3f158da1abf12fb 100644 --- a/trace_streamer/src/base/codec_cov.cpp +++ b/trace_streamer/src/base/codec_cov.cpp @@ -138,26 +138,21 @@ std::wstring String2WString(const std::string &strInput) std::cout << "strInput is empty" << std::endl; return L""; } - // 获取待转换的数据的长度 int len_in = MultiByteToWideChar(codePage, 0, (LPCSTR)strInput.c_str(), -1, NULL, 0); if (len_in <= 0) { std::cout << "The result of WideCharToMultiByte is Invalid!" << std::endl; return L""; } - // 为输出数据申请空间 std::wstring wstr_out; wstr_out.resize(len_in - 1, L'\0'); - // 数据格式转换 int to_result = MultiByteToWideChar(codePage, 0, (LPCSTR)strInput.c_str(), -1, (LPWSTR)wstr_out.c_str(), len_in); - // 判断转换结果 if (0 == to_result) { std::cout << "Can't transfer String to WString" << std::endl; } - return wstr_out; } #endif diff --git a/trace_streamer/src/base/file.h b/trace_streamer/src/base/file.h index d66b2aaa03e521c1d0921c33810e7d37acdec64f..c7109601ec62d28f417c0a968f337836afc051bd 100644 --- a/trace_streamer/src/base/file.h +++ b/trace_streamer/src/base/file.h @@ -56,7 +56,7 @@ bool LocalUnzip(const std::string &zipFile, const std::string &dstDir); class LocalZip { public: - LocalZip(const std::string &file); + explicit LocalZip(const std::string &file); bool Unzip(std::string &traceFile); private: