From 99c6e1298476f01e49a1fb2c9e89d330ccb63c38 Mon Sep 17 00:00:00 2001 From: liufei Date: Thu, 14 Dec 2023 17:06:03 +0800 Subject: [PATCH 1/5] =?UTF-8?q?helpdocument=E6=B7=BB=E5=8A=A0=E6=94=B6?= =?UTF-8?q?=E8=B5=B7=E5=9B=BE=E6=A0=87=E5=B9=B6=E4=BF=AE=E6=94=B9=E8=BE=B9?= =?UTF-8?q?=E8=B7=9D=EF=BC=8Chiperf=20callchart=E9=BB=98=E8=AE=A4=E6=94=B6?= =?UTF-8?q?=E8=B5=B7=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=9B=9B=E6=9D=A1=E6=B3=B3?= =?UTF-8?q?=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liufei --- ide/src/base-ui/menu/LitMainMenu.ts | 17 ++++- ide/src/base-ui/menu/LitMainMenuGroup.ts | 41 ++++++++--- ide/src/trace/SpApplication.ts | 7 ++ ide/src/trace/component/SpHelp.ts | 10 +++ .../trace/component/chart/SpChartManager.ts | 7 +- ide/src/trace/component/chart/SpHiPerf.ts | 25 +++---- .../trace/component/trace/base/TraceRow.ts | 72 +++++++++++++++---- .../database/ui-worker/ProcedureWorker.ts | 4 ++ ide/webpack.config.js | 59 +++++++++------ 9 files changed, 182 insertions(+), 60 deletions(-) diff --git a/ide/src/base-ui/menu/LitMainMenu.ts b/ide/src/base-ui/menu/LitMainMenu.ts index 8a6f3760b..9f287b122 100644 --- a/ide/src/base-ui/menu/LitMainMenu.ts +++ b/ide/src/base-ui/menu/LitMainMenu.ts @@ -44,7 +44,12 @@ export class LitMainMenu extends BaseElement { value?.forEach((it) => { let group = new LitMainMenuGroup(); group.setAttribute('title', it.title || ''); - group.setAttribute('describe', it.describe || ''); + if (it.describe !== '') { + group.setAttribute('describe', it.describe || ''); + } else { + group.removeAttribute('describe'); + } + group.setAttribute('icon', it.icon || ''); if (it.collapsed) { group.setAttribute('collapsed', ''); } else { @@ -57,7 +62,12 @@ export class LitMainMenu extends BaseElement { if (item.children && item.children.length > 0) { let secondGroup = new LitMainMenuGroup(); secondGroup.setAttribute('title', item.title || ''); - secondGroup.setAttribute('describe', item.describe || ''); + if (item.describe !== '') { + secondGroup.setAttribute('describe', item.describe || ''); + } else { + secondGroup.removeAttribute('describe'); + } + secondGroup.setAttribute('icon', item.icon || ''); if (item.second) { secondGroup.setAttribute('second', ''); } else { @@ -72,7 +82,7 @@ export class LitMainMenu extends BaseElement { item.children?.forEach((v: any) => { let th = new LitMainMenuItem(); th.setAttribute('icon', v.icon || ''); - th.setAttribute('title', v.title || '');if (this.getAttribute('main_menu') === '1' && window.localStorage.getItem('Theme') === 'dark') { + th.setAttribute('title', v.title || ''); if (this.getAttribute('main_menu') === '1' && window.localStorage.getItem('Theme') === 'dark') { groupName.style.color = 'white'; groupDescribe.style.color = 'white'; th!.style.color = 'white'; @@ -245,6 +255,7 @@ export interface MenuGroup { second: boolean; collapsed: boolean; children: any; + icon: string; } export interface MenuItem { diff --git a/ide/src/base-ui/menu/LitMainMenuGroup.ts b/ide/src/base-ui/menu/LitMainMenuGroup.ts index b9d0fbedf..869978b09 100644 --- a/ide/src/base-ui/menu/LitMainMenuGroup.ts +++ b/ide/src/base-ui/menu/LitMainMenuGroup.ts @@ -21,9 +21,10 @@ export class LitMainMenuGroup extends BaseElement { private groupNameEl: HTMLElement | null | undefined; private groupDescEl: HTMLElement | null | undefined; private group: HTMLElement | null | undefined; + private iconEl: HTMLElement | null | undefined; static get observedAttributes() { - return ['title', 'describe', 'collapsed', 'nocollapse', 'radius', 'second']; + return ['title', 'describe', 'collapsed', 'nocollapse', 'radius', 'second', 'icon']; } get second() { @@ -67,8 +68,9 @@ export class LitMainMenuGroup extends BaseElement { } initElements(): void { - this.groupNameEl = this.shadowRoot?.querySelector('.group-name'); + this.groupNameEl = this.shadowRoot?.querySelector('.group-title'); this.groupDescEl = this.shadowRoot?.querySelector('.group-describe'); + this.iconEl = this.shadowRoot?.querySelector('.icon'); this.group = this.shadowRoot?.querySelector('#group'); this.group!.addEventListener('click', (e) => { if (this.nocollapsed) { @@ -104,6 +106,7 @@ export class LitMainMenuGroup extends BaseElement { :host(:not([collapsed])) .group-describe{ height: 0; visibility: hidden; + padding:0; } :host([collapsed]):hover){ background-color: #FFFFFF; @@ -128,25 +131,38 @@ export class LitMainMenuGroup extends BaseElement { :host([collapsed]) ::slotted(lit-main-menu-group){ display:none; } + :host(:not([describe])) .group-describe{ + display:none; + } + :host([describe]) .group-describe{ + padding: 4px 24px 0 24px; + color: #999 !important; + font-size: 1rem; + } + :host([describe]) .group-name{ + margin-top: 10px; + } .group-name{ + display:flex; font-size: 14px; font-family: Helvetica; color: #000; - padding: 20px 24px 0px 24px; + padding: 15px 24px 5px 10px; line-height: 16px; font-weight: 400; text-align: left; } - .group-describe{ - color: #000; - font-size: 0.6rem; - padding: 4px 24px 20px 24px; + :host([collapsed]) .icon{ + transform: rotateZ(-90deg); } -
-
-
-
+
+
+ + +
+
+
`; } @@ -159,6 +175,9 @@ export class LitMainMenuGroup extends BaseElement { case 'describe': if (this.groupDescEl) this.groupDescEl.textContent = newValue; break; + case 'icon': + if (this.iconEl) this.iconEl.setAttribute('name', newValue); + break; } } } diff --git a/ide/src/trace/SpApplication.ts b/ide/src/trace/SpApplication.ts index 5b760f70c..00af9a153 100644 --- a/ide/src/trace/SpApplication.ts +++ b/ide/src/trace/SpApplication.ts @@ -1064,6 +1064,7 @@ export class SpApplication extends BaseElement { collapsed: false, title: 'Current Trace', second: false, + icon:'', describe: 'Actions on the current trace', children: getTraceOptionMenus(showFileName, fileSize, fileName, true, dbName), }); @@ -1411,6 +1412,7 @@ export class SpApplication extends BaseElement { collapsed: false, title: 'Convert trace', second: false, + icon:'', describe: 'Convert to other formats', children: pushConvertTrace(fileName), }); @@ -1420,6 +1422,7 @@ export class SpApplication extends BaseElement { collapsed: false, title: 'Support', second: false, + icon:'', describe: 'Support', children: [ { @@ -1467,6 +1470,7 @@ export class SpApplication extends BaseElement { collapsed: false, title: 'Current Trace', second: false, + icon:'', describe: 'Actions on the current trace', children: getTraceOptionMenus(showFileName, fileSize, fileName, false), }); @@ -1763,6 +1767,7 @@ export class SpApplication extends BaseElement { collapsed: false, title: 'Current Trace', second: false, + icon:'', describe: 'Actions on the current trace', children: getTraceOptionMenus(showFileName, fileSize, fileName, false), }); @@ -1789,6 +1794,7 @@ export class SpApplication extends BaseElement { collapsed: false, title: 'Navigation', second: false, + icon:'', describe: 'Open or record a new trace', children: [ { @@ -1848,6 +1854,7 @@ export class SpApplication extends BaseElement { collapsed: false, title: 'Support', second: false, + icon:'', describe: 'Support', children: [ { diff --git a/ide/src/trace/component/SpHelp.ts b/ide/src/trace/component/SpHelp.ts index 4af9598ea..1ee902efa 100644 --- a/ide/src/trace/component/SpHelp.ts +++ b/ide/src/trace/component/SpHelp.ts @@ -55,6 +55,7 @@ export class SpHelp extends BaseElement { collapsed: false, title: 'QuickStart', second: false, + icon:'caret-down', describe: '', children: [ { @@ -62,6 +63,7 @@ export class SpHelp extends BaseElement { title: '抓取和导入', describe: '', second: true, + icon:'caret-down', children: [ { title: '设备端抓取trace说明', @@ -108,6 +110,7 @@ export class SpHelp extends BaseElement { collapsed: false, title: '内存', describe: '', + icon:'caret-down', second: true, children: [ { @@ -170,6 +173,7 @@ export class SpHelp extends BaseElement { title: 'Native栈', describe: '', second: true, + icon:'caret-down', children: [ { title: 'HiPerf的抓取和展示说明', @@ -191,6 +195,7 @@ export class SpHelp extends BaseElement { title: 'TS栈', describe: '', second: true, + icon:'caret-down', children: [ { title: 'Cpuprofiler抓取和展示说明', @@ -212,6 +217,7 @@ export class SpHelp extends BaseElement { title: '分析模板', describe: '', second: true, + icon:'caret-down', children: [ { title: 'Frame timeline抓取和展示说明', @@ -285,6 +291,7 @@ export class SpHelp extends BaseElement { title: '文件', describe: '', second: true, + icon:'caret-down', children: [ { title: 'FileSystem抓取和展示说明', @@ -319,6 +326,7 @@ export class SpHelp extends BaseElement { title: '其他', describe: '', second: true, + icon:'caret-down', children: [ { title: 'Sql分析和Metrics说明', @@ -449,6 +457,7 @@ export class SpHelp extends BaseElement { title: 'TraceStreamer', second: false, describe: '', + icon:'caret-down', children: [ { title: 'TraceStreamer数据库说明', @@ -524,6 +533,7 @@ export class SpHelp extends BaseElement { title: 'SmartPerf', second: false, describe: '', + icon:'caret-down', children: [ { title: 'SmartPerf 编译指导', diff --git a/ide/src/trace/component/chart/SpChartManager.ts b/ide/src/trace/component/chart/SpChartManager.ts index 248f13166..50dcaa253 100644 --- a/ide/src/trace/component/chart/SpChartManager.ts +++ b/ide/src/trace/component/chart/SpChartManager.ts @@ -50,7 +50,8 @@ import { FlagsConfig } from '../SpFlags'; import { SpLogChart } from './SpLogChart'; import { SpHiSysEventChart } from './SpHiSysEventChart'; import { SpAllAppStartupsChart } from './SpAllAppStartups'; -import {setVSyncData} from './VSync'; +import { setVSyncData } from './VSync'; +import { SpSegmentationChart } from './SpSegmentationChart'; export class SpChartManager { static APP_STARTUP_PID_ARR: Array = []; @@ -75,6 +76,7 @@ export class SpChartManager { public arkTsChart: SpArkTsChart; private logChart: SpLogChart; private spHiSysEvent: SpHiSysEventChart; + private spSegmentationChart: SpSegmentationChart; constructor(trace: SpSystemTrace) { this.trace = trace; @@ -97,6 +99,7 @@ export class SpChartManager { this.logChart = new SpLogChart(trace); this.spHiSysEvent = new SpHiSysEventChart(trace); this.spAllAppStartupsChart = new SpAllAppStartupsChart(trace); + this.spSegmentationChart = new SpSegmentationChart(trace); } async init(progress: Function) { @@ -141,6 +144,8 @@ export class SpChartManager { progress('Irq init', 84); await this.irqChart.init(); info('Cpu Freq Data initialized'); + progress('SpSegmentationChart inin', 84.5); + await this.spSegmentationChart.init(); await this.virtualMemChart.init(); progress('fps', 85); await this.fps.init(); diff --git a/ide/src/trace/component/chart/SpHiPerf.ts b/ide/src/trace/component/chart/SpHiPerf.ts index 439975f86..c0ee12942 100644 --- a/ide/src/trace/component/chart/SpHiPerf.ts +++ b/ide/src/trace/component/chart/SpHiPerf.ts @@ -209,6 +209,7 @@ export class SpHiPerf { perfCallCutRow.folder = false; perfCallCutRow.drawType = -2; perfCallCutRow.name = 'CallChart [cpu0]'; + perfCallCutRow.funcExpand = false; perfCallCutRow.setAttribute('children', ''); perfCallCutRow.favoriteChangeHandler = this.trace.favoriteChangeHandler; perfCallCutRow.selectChangeHandler = this.trace.selectChangeHandler; @@ -228,7 +229,7 @@ export class SpHiPerf { `Name: ${callName}
Lib: - ${perfDataQuery.getLibName(hoverStruct!.fileId,hoverStruct!.symbolId)}
+ ${perfDataQuery.getLibName(hoverStruct!.fileId, hoverStruct!.symbolId)}
Self Time: ${Utils.getProbablyTime(selfDur || 0)}
Duration: @@ -274,16 +275,16 @@ export class SpHiPerf { row.rowSetting = 'enable'; row.rowSettingList = [ ...cpuData.reverse().map((it: any): { - key: string; - title: string; - checked?: boolean - } => { - return { - key: `${it.cpu_id}-c`, - checked: it.cpu_id === 0, - title: `cpu${it.cpu_id}`, - }; - } + key: string; + title: string; + checked?: boolean + } => { + return { + key: `${it.cpu_id}-c`, + checked: it.cpu_id === 0, + title: `cpu${it.cpu_id}`, + }; + } ), ...Array.from(pt.values()) ]; @@ -569,7 +570,7 @@ export class SpHiPerf { row.isComplete = false; } - resetAllChartData() : void { + resetAllChartData(): void { this.rowList?.forEach(row => this.resetChartData(row)); } diff --git a/ide/src/trace/component/trace/base/TraceRow.ts b/ide/src/trace/component/trace/base/TraceRow.ts index 55a759360..f82449d83 100644 --- a/ide/src/trace/component/trace/base/TraceRow.ts +++ b/ide/src/trace/component/trace/base/TraceRow.ts @@ -44,6 +44,11 @@ let dragDirection: string = ''; @element('trace-row') export class TraceRow extends HTMLElement { + static ROW_TYPE_SPSEGNENTATION = 'spsegmentation'; + static ROW_TYPE_CPU_COMPUTILITY = 'cpu-computility'; + static ROW_TYPE_GPU_COMPUTILITY = 'gpu-computility'; + static ROW_TYPE_BINDER_COUNT = 'binder-count'; + static ROW_TYPE_SCHED_SWITCH = 'sched-switch'; static ROW_TYPE_CPU = 'cpu-data'; static ROW_TYPE_CPU_STATE = 'cpu-state'; static ROW_TYPE_CPU_FREQ = 'cpu-freq'; @@ -143,6 +148,7 @@ export class TraceRow extends HTMLElement { public collectEL: LitIcon | null | undefined; public onThreadHandler: ((useCache: boolean, buf: ArrayBuffer | undefined | null) => void) | undefined | null; public onRowSettingChangeHandler: ((keys: Array, nodes: Array) => void) | undefined | null; + public onRowCheckFileChangeHandler: ((file: string | ArrayBuffer | null) => void) | undefined | null; public supplier: (() => Promise>) | undefined | null; public favoriteChangeHandler: ((fav: TraceRow) => void) | undefined | null; public selectChangeHandler: ((traceRow: TraceRow) => void) | undefined | null; @@ -161,6 +167,8 @@ export class TraceRow extends HTMLElement { private nameEL: HTMLLabelElement | null | undefined; private rowSettingTree: LitTree | null | undefined; private rowSettingPop: LitPopover | null | undefined; + private fileEL: any; + private rowCheckFilePop: LitPopover | null | undefined; private _rangeSelect: boolean = false; private _drawType: number = 0; private folderIconEL: LitIcon | null | undefined; @@ -188,12 +196,12 @@ export class TraceRow extends HTMLElement { isOffScreen: boolean; skeleton?: boolean; } = { - canvasNumber: 1, - alpha: false, - contextId: '2d', - isOffScreen: true, - skeleton: false, - } + canvasNumber: 1, + alpha: false, + contextId: '2d', + isOffScreen: true, + skeleton: false, + } ) { super(); this.args = args; @@ -251,13 +259,13 @@ export class TraceRow extends HTMLElement { set funcExpand(b: boolean) { this.setAttribute('func-expand', b ? 'true' : 'false'); } - get sticky():boolean{ + get sticky(): boolean { return this.hasAttribute('sticky'); } - set sticky(fixed:boolean){ + set sticky(fixed: boolean) { if (fixed) { this.setAttribute('sticky', ''); - }else{ + } else { this.removeAttribute('sticky'); } } @@ -708,7 +716,7 @@ export class TraceRow extends HTMLElement { this.checkType = '-1'; } - addRowSettingPop(): void{ + addRowSettingPop(): void { this.rowSettingPop = document.createElement('lit-popover') as LitPopover; this.rowSettingPop.innerHTML = `
@@ -737,7 +745,39 @@ export class TraceRow extends HTMLElement { this.describeEl?.appendChild(this.rowSettingPop); } - getRowSettingKeys() : Array { + addRowCheckFilePop(): void { + this.rowCheckFilePop = document.createElement('litpopover') as LitPopover; + this.rowCheckFilePop.innerHTML = `
+
+ + `; + this.rowCheckFilePop.id = 'rowCheckFile'; + this.rowCheckFilePop.className = 'popover checkFile'; + this.rowCheckFilePop.setAttribute('trigger', 'click'); + this.rowCheckFilePop?.addEventListener('mouseenter', (e) => { + window.publish(window.SmartEvent.UI.HoverNull, undefined); + }); + this.fileEL = this.rowCheckFilePop.querySelector('#jsoninput'); + this.rowCheckFilePop.onclick = (): void => { + this.fileEL.click(); + this.fileEL.addEventListener('change', (e: any) => { + let file = e.target.files[0]; + if (file.type === 'application/json') { + let file_reader = new FileReader(); + file_reader.readAsText(file, 'UTF-8'); + file_reader.onload = () => { + let fc = file_reader.result; + this.onRowCheckFileChangeHandler?.(fc) + }; + } else { + return + } + }, false) + } + this.describeEl?.appendChild(this.rowCheckFilePop); + } + + getRowSettingKeys(): Array { if (this.rowSetting === 'enable') { return this.rowSettingTree!.getCheckdKeys(); } @@ -756,7 +796,7 @@ export class TraceRow extends HTMLElement { } } - enableCollapseChart() : void { + enableCollapseChart(): void { this._enableCollapseChart = true; this.nameEL!.onclick = () => { if (this.funcExpand) { @@ -1440,7 +1480,13 @@ export class TraceRow extends HTMLElement { } :host([row-setting='enable']:not([check-type='-1'])) .collect{ margin-right: 5px; - } + } + :host([row-setting='checkFile']) #rowCheckFile{ + display:flex; + } + :host([row-setting='checkFile']) #myfolder{ + color:#4b5766; + }
diff --git a/ide/src/trace/database/ui-worker/ProcedureWorker.ts b/ide/src/trace/database/ui-worker/ProcedureWorker.ts index df8360f91..23504dd78 100644 --- a/ide/src/trace/database/ui-worker/ProcedureWorker.ts +++ b/ide/src/trace/database/ui-worker/ProcedureWorker.ts @@ -59,6 +59,8 @@ import { LogRender } from './ProcedureWorkerLog'; import { HiPerfCallChartRender } from './ProcedureWorkerHiPerfCallChart'; import { HiSysEventRender } from './ProcedureWorkerHiSysEvent'; import { AllAppStartupRender } from './ProcedureWorkerAllAppStartup'; +import { FreqExtendRender } from './ProcedureWorkerFreqExtend'; +import { BinderRender } from './procedureWorkerBinder'; let dataList: any = {}; let dataList2: any = {}; @@ -115,6 +117,8 @@ export let renders: any = { snapshot: new SnapshotRender(), logs: new LogRender(), hiSysEvent: new HiSysEventRender(), + 'freq-extend': new FreqExtendRender(), + 'binder' : new BinderRender(), }; function match(type: string, req: RequestMessage): void { diff --git a/ide/webpack.config.js b/ide/webpack.config.js index 38d6d8ad7..8ecc16731 100644 --- a/ide/webpack.config.js +++ b/ide/webpack.config.js @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - // Generated using webpack-cli https://github.com/webpack/webpack-cli const path = require('path'); @@ -26,16 +25,6 @@ const childProcess = require('child_process'); const { exec } = require('child_process'); const fs = require('fs'); - -function directoryExists(path) { - try { - fs.accessSync(path); - return true; - } catch (error) { - return false; - } -} - function runCommand(command) { return new Promise((resolve, reject) => { exec(command, (error, stdout, stderr) => { @@ -48,6 +37,42 @@ function runCommand(command) { }); } +function cpFile(sourcePath, targetPath) { + fs.readdir(sourcePath, (err, files) => { + if (err) { + console.error('无法读取目录', err); + return; + } + files.forEach((file) => { + const source = `${sourcePath}/${file}`; + const target = `${targetPath}/${file}`; + fs.copyFile(source, target, (err) => { + if (err) { + console.error('无法复制文件', err); + return; + } + }); + }); + }); +} + +function clearDirectory(directoryPath) { + const isDirectoryExists = fs.existsSync(directoryPath); + + if (!isDirectoryExists) { + fs.mkdirSync(directoryPath); + } else { + fs.readdirSync(directoryPath).forEach((file) => { + const filePath = path.join(directoryPath, file); + if (fs.lstatSync(filePath).isDirectory()) { + return; + } else { + fs.unlinkSync(filePath); // 删除文件 + } + }); + } +} + const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader'; //compile server ((flag) => { @@ -57,15 +82,9 @@ const stylesHandler = isProduction ? MiniCssExtractPlugin.loader : 'style-loader console.log('start compile server'); let outPath = path.normalize(path.join(__dirname, '/', 'dist')); let serverSrc = path.normalize(path.join(__dirname, '/server/main.go')); - if (!directoryExists(outPath)) { - runCommand(`mkdir ${outPath}`); - } else { - runCommand(`rm -rf ${outPath}/* `).then((result) => { - - }); - } - runCommand(`cp ./bin/* dist/`); - + let binPath = path.normalize(path.join(__dirname, '/', 'bin')); + clearDirectory(outPath); + cpFile(binPath, outPath); let rs; if (os.type() === 'Windows_NT') { rs = childProcess.spawnSync('go', ['build', '-o', outPath, serverSrc], { -- Gitee From fab1608c19d73ef8b224b372abaef73a3024ff38 Mon Sep 17 00:00:00 2001 From: liufei Date: Thu, 14 Dec 2023 18:27:13 +0800 Subject: [PATCH 2/5] =?UTF-8?q?helpdocument=E6=B7=BB=E5=8A=A0=E6=8A=98?= =?UTF-8?q?=E5=8F=A0=E6=A0=87=E5=BF=97=E5=B9=B6=E8=B0=83=E6=95=B4=E9=97=B4?= =?UTF-8?q?=E8=B7=9D=EF=BC=8Chiperf=20callchart=E9=BB=98=E8=AE=A4=E6=8A=98?= =?UTF-8?q?=E5=8F=A0=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=9B=9B=E6=9D=A1=E6=B3=B3?= =?UTF-8?q?=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liufei --- .../trace/component/chart/SpChartManager.ts | 6 +- .../component/chart/SpSegmentationChart.ts | 491 ++++++++++++++++++ .../ui-worker/ProcedureWorkerFreqExtend.ts | 117 +++++ .../ui-worker/procedureWorkerBinder.ts | 105 ++++ 4 files changed, 716 insertions(+), 3 deletions(-) create mode 100644 ide/src/trace/component/chart/SpSegmentationChart.ts create mode 100644 ide/src/trace/database/ui-worker/ProcedureWorkerFreqExtend.ts create mode 100644 ide/src/trace/database/ui-worker/procedureWorkerBinder.ts diff --git a/ide/src/trace/component/chart/SpChartManager.ts b/ide/src/trace/component/chart/SpChartManager.ts index 50dcaa253..d1d824022 100644 --- a/ide/src/trace/component/chart/SpChartManager.ts +++ b/ide/src/trace/component/chart/SpChartManager.ts @@ -76,7 +76,7 @@ export class SpChartManager { public arkTsChart: SpArkTsChart; private logChart: SpLogChart; private spHiSysEvent: SpHiSysEventChart; - private spSegmentationChart: SpSegmentationChart; + private SpSegmentationChart: SpSegmentationChart; constructor(trace: SpSystemTrace) { this.trace = trace; @@ -99,7 +99,7 @@ export class SpChartManager { this.logChart = new SpLogChart(trace); this.spHiSysEvent = new SpHiSysEventChart(trace); this.spAllAppStartupsChart = new SpAllAppStartupsChart(trace); - this.spSegmentationChart = new SpSegmentationChart(trace); + this.SpSegmentationChart = new SpSegmentationChart(trace); } async init(progress: Function) { @@ -145,7 +145,7 @@ export class SpChartManager { await this.irqChart.init(); info('Cpu Freq Data initialized'); progress('SpSegmentationChart inin', 84.5); - await this.spSegmentationChart.init(); + await this.SpSegmentationChart.init(); await this.virtualMemChart.init(); progress('fps', 85); await this.fps.init(); diff --git a/ide/src/trace/component/chart/SpSegmentationChart.ts b/ide/src/trace/component/chart/SpSegmentationChart.ts new file mode 100644 index 000000000..a3fd22397 --- /dev/null +++ b/ide/src/trace/component/chart/SpSegmentationChart.ts @@ -0,0 +1,491 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { SpSystemTrace } from '../SpSystemTrace'; +import { ColorUtils } from '../trace/base/ColorUtils'; +import { TraceRow } from '../trace/base/TraceRow'; +import { renders } from '../../database/ui-worker/ProcedureWorker'; +import { EmptyRender } from '../../database/ui-worker/ProcedureWorkerCPU'; +import { FreqExtendRender, CpuFreqExtendStruct } from '../../database/ui-worker/ProcedureWorkerFreqExtend'; +import { BinderRender, BinderStruct } from '../../database/ui-worker/procedureWorkerBinder'; +import { queryIrqList } from '../../database/SqlLite'; +import { BaseStruct } from '../../bean/BaseStruct'; + +export class SpSegmentationChart { + static trace: SpSystemTrace; + static jsonRow: TraceRow | undefined; + static GpuRow: TraceRow | undefined; + static binderRow: TraceRow | undefined; + static schedRow: TraceRow | undefined; + static freqInfoMapData = new Map>(); + private rowFolder!: TraceRow; + static chartData: Array = [];; + // 数据切割联动 + static setChartData(type: string, data: Array) { + let currentMaxValue: number = 0; + if (type === 'CPU-FREQ') { + setCpuData(data, currentMaxValue, type); + } + else if (type === 'GPU-FREQ') { + setGpuData(data, currentMaxValue, type) + } else { + setSchedData(data, currentMaxValue, type) + } + SpSegmentationChart.trace.refreshCanvas(true) + } + + // binder联动调用 + static setBinderChartData(type: string, data: Array>) { + BinderStruct.maxHeight = 0; + let binderList: Array = []; + let chartData: Array = []; + setBinderData(data, binderList); + chartData = binderList.map((v: BinderDataStruct) => { + return { + cpu: v.name === 'binder transaction' ? + 0 : v.name === 'binder transaction async' ? + 1 : v.name === 'binder reply' ? + 2 : 3, + startNS: v.startNS, + dur: v.dur, + name: `${v.name}`, + value: v.count, + depth: v.depth, + cycle: v.idx, + idx: v.idx, + count: v.count, + } + }) + SpSegmentationChart.binderRow!.dataList = []; + SpSegmentationChart.binderRow!.dataListCache = []; + SpSegmentationChart.binderRow!.isComplete = false; + SpSegmentationChart.binderRow!.style.height = `${BinderStruct.maxHeight > 2 ? BinderStruct.maxHeight * 20 + 20 : 40}px`; + // @ts-ignore + SpSegmentationChart.binderRow!.supplier = (): Promise> => + new Promise>((resolve) => resolve(chartData)); + } + + // 悬浮联动 + static tabHover(type: String, tableIsHover: boolean = false, cycle: number = -1) { + CpuFreqExtendStruct.isTabHover = tableIsHover; + if (type === 'CPU-FREQ' || type === 'GPU-FREQ' || type === 'SCHED-SWITCH') { + if (tableIsHover) { + SpSegmentationChart.jsonRow!.isHover = false; + SpSegmentationChart.GpuRow!.isHover = false; + CpuFreqExtendStruct.cycle = cycle; + } else { + CpuFreqExtendStruct.cycle = -1 + CpuFreqExtendStruct.hoverCpuFreqStruct = undefined; + } + } else if (type === 'BINDER') { + if (tableIsHover) { + BinderStruct.hoverCycle = cycle; + } else { + BinderStruct.hoverCycle = -1; + } + } + SpSegmentationChart.trace.refreshCanvas(true, 'flagChange') + } + + constructor(trace: SpSystemTrace) { + SpSegmentationChart.trace = trace; + } + + async init() { + let irqList = await queryIrqList(); + if (irqList.length == 0) { + return; + } + else { + await this.initFolder(); + await this.initCpuFreq(); + await this.initGpuTrace(); + await this.initSchedTrace(); + await this.initBinderTrace(); + } + } + + async initFolder() { + let row = TraceRow.skeleton(); + row.setAttribute('disabled-check', ''); + row.rowId = `unkown`; + row.index = 0; + row.rowType = TraceRow.ROW_TYPE_SPSEGNENTATION; + row.rowParentId = ''; + row.folder = true; + row.style.height = '40px'; + row.name = `Segmentation`; + row.supplier = () => new Promise>((resolve) => resolve([])); + row.onThreadHandler = (useCache) => { + row.canvasSave(SpSegmentationChart.trace.canvasPanelCtx!); + if (row.expansion) { + SpSegmentationChart.trace.canvasPanelCtx?.clearRect(0, 0, row.frame.width, row.frame.height); + } else { + (renders['empty'] as EmptyRender).renderMainThread( + { + context: SpSegmentationChart.trace.canvasPanelCtx, + useCache: useCache, + type: ``, + }, + row, + ); + } + row.canvasRestore(SpSegmentationChart.trace.canvasPanelCtx!); + }; + this.rowFolder = row; + SpSegmentationChart.trace.rowsEL?.appendChild(row); + + } + + async initCpuFreq() { + // json文件泳道 + SpSegmentationChart.jsonRow = TraceRow.skeleton(); + SpSegmentationChart.jsonRow.rowId = `json0`; + SpSegmentationChart.jsonRow.rowType = TraceRow.ROW_TYPE_CPU_COMPUTILITY; + SpSegmentationChart.jsonRow.rowParentId = ''; + SpSegmentationChart.jsonRow.style.height = '40px'; + SpSegmentationChart.jsonRow.name = `Cpu Computility`; + SpSegmentationChart.jsonRow.favoriteChangeHandler = SpSegmentationChart.trace.favoriteChangeHandler; + SpSegmentationChart.jsonRow.addRowCheckFilePop(); + SpSegmentationChart.jsonRow.rowSetting = 'checkFile'; + // 拿到了用户传递的数据 + SpSegmentationChart.jsonRow.onRowCheckFileChangeHandler = (e: string | ArrayBuffer | null) => { + // @ts-ignore + let chartData = JSON.parse(e); + let mapData = new Map(); + // @ts-ignore + chartData.map((v) => { + for (let key in v.freqInfo) { + mapData.set(Number(key), Number(v.freqInfo[key])) + } + SpSegmentationChart.freqInfoMapData.set(v.cpuId, mapData) + mapData = new Map() + }) + } + SpSegmentationChart.jsonRow.focusHandler = (ev) => { + SpSegmentationChart.trace?.displayTip( + SpSegmentationChart.jsonRow!, + CpuFreqExtendStruct.hoverCpuFreqStruct, + `${CpuFreqExtendStruct.hoverCpuFreqStruct === undefined ? 0 : CpuFreqExtendStruct.hoverCpuFreqStruct.value!}` + ); + }; + SpSegmentationChart.jsonRow.findHoverStruct = () => { + CpuFreqExtendStruct.hoverCpuFreqStruct = SpSegmentationChart.jsonRow!.getHoverStruct(); + }; + // @ts-ignore + SpSegmentationChart.jsonRow.supplier = (): Promise> => + new Promise>((resolve) => resolve([])); + SpSegmentationChart.jsonRow.onThreadHandler = (useCache) => { + let context: CanvasRenderingContext2D; + if (SpSegmentationChart.jsonRow!.currentContext) { + context = SpSegmentationChart.jsonRow!.currentContext; + } else { + context = SpSegmentationChart.jsonRow!.collect ? SpSegmentationChart.trace.canvasFavoritePanelCtx! : SpSegmentationChart.trace.canvasPanelCtx!; + } + SpSegmentationChart.jsonRow!.canvasSave(context); + (renders['freq-extend'] as FreqExtendRender).renderMainThread( + { + context: context, + useCache: useCache, + type: `json0`, + }, + SpSegmentationChart.jsonRow! + ); + SpSegmentationChart.jsonRow!.canvasRestore(context); + }; + SpSegmentationChart.trace.rowsEL?.appendChild(SpSegmentationChart.jsonRow); + this.rowFolder!.addChildTraceRow(SpSegmentationChart.jsonRow); + } + + async initGpuTrace() { + SpSegmentationChart.GpuRow = TraceRow.skeleton(); + SpSegmentationChart.GpuRow.rowId = `gpurow`; + SpSegmentationChart.GpuRow.rowType = TraceRow.ROW_TYPE_GPU_COMPUTILITY; + SpSegmentationChart.GpuRow.rowParentId = ''; + SpSegmentationChart.GpuRow.style.height = '40px'; + SpSegmentationChart.GpuRow.name = `Gpu Computility`; + SpSegmentationChart.GpuRow.favoriteChangeHandler = SpSegmentationChart.trace.favoriteChangeHandler; + SpSegmentationChart.GpuRow.selectChangeHandler = SpSegmentationChart.trace.selectChangeHandler; + // @ts-ignore + SpSegmentationChart.GpuRow.supplier = (): Promise> => + new Promise>((resolve) => resolve([])); + SpSegmentationChart.GpuRow.focusHandler = (ev) => { + SpSegmentationChart.trace?.displayTip( + SpSegmentationChart.GpuRow!, + CpuFreqExtendStruct.hoverCpuFreqStruct, + `${CpuFreqExtendStruct.hoverCpuFreqStruct === undefined ? 0 : CpuFreqExtendStruct.hoverCpuFreqStruct.value!} Hz·ms` + ); + }; + SpSegmentationChart.GpuRow.findHoverStruct = () => { + CpuFreqExtendStruct.hoverCpuFreqStruct = SpSegmentationChart.GpuRow!.getHoverStruct(); + }; + SpSegmentationChart.GpuRow.onThreadHandler = (useCache) => { + let context: CanvasRenderingContext2D; + if (SpSegmentationChart.GpuRow!.currentContext) { + context = SpSegmentationChart.GpuRow!.currentContext; + } else { + context = SpSegmentationChart.GpuRow!.collect ? SpSegmentationChart.trace.canvasFavoritePanelCtx! : SpSegmentationChart.trace.canvasPanelCtx!; + } + SpSegmentationChart.GpuRow!.canvasSave(context); + (renders['freq-extend'] as FreqExtendRender).renderMainThread( + { + context: context, + useCache: useCache, + type: `json1`, + }, + SpSegmentationChart.GpuRow! + ); + SpSegmentationChart.GpuRow!.canvasRestore(context); + }; + SpSegmentationChart.trace.rowsEL?.appendChild(SpSegmentationChart.GpuRow); + this.rowFolder!.addChildTraceRow(SpSegmentationChart.GpuRow); + } + + async initSchedTrace() { + SpSegmentationChart.schedRow = TraceRow.skeleton(); + SpSegmentationChart.schedRow.rowId = `sched_switch Count`; + SpSegmentationChart.schedRow.rowType = TraceRow.ROW_TYPE_SCHED_SWITCH; + SpSegmentationChart.schedRow.rowParentId = ''; + SpSegmentationChart.schedRow.style.height = '40px'; + SpSegmentationChart.schedRow.name = `Sched_switch Count`; + SpSegmentationChart.schedRow.favoriteChangeHandler = SpSegmentationChart.trace.favoriteChangeHandler; + SpSegmentationChart.schedRow.selectChangeHandler = SpSegmentationChart.trace.selectChangeHandler; + SpSegmentationChart.schedRow.focusHandler = (ev) => { + SpSegmentationChart.trace?.displayTip( + SpSegmentationChart.schedRow!, + CpuFreqExtendStruct.hoverCpuFreqStruct, + `${ColorUtils.formatNumberComma(CpuFreqExtendStruct.hoverCpuFreqStruct?.value!)} Hz·ms` + ); + }; + SpSegmentationChart.schedRow.findHoverStruct = () => { + CpuFreqExtendStruct.hoverCpuFreqStruct = SpSegmentationChart.schedRow!.getHoverStruct(); + }; + // @ts-ignore + SpSegmentationChart.schedRow.supplier = (): Promise> => + new Promise>((resolve) => resolve([])); + SpSegmentationChart.schedRow.onThreadHandler = (useCache) => { + let context: CanvasRenderingContext2D; + if (SpSegmentationChart.schedRow!.currentContext) { + context = SpSegmentationChart.schedRow!.currentContext; + } else { + context = SpSegmentationChart.schedRow!.collect ? SpSegmentationChart.trace.canvasFavoritePanelCtx! : SpSegmentationChart.trace.canvasPanelCtx!; + } + SpSegmentationChart.schedRow!.canvasSave(context); + (renders['freq-extend'] as FreqExtendRender).renderMainThread( + { + context: context, + useCache: useCache, + type: `json0`, + }, + SpSegmentationChart.schedRow! + ); + SpSegmentationChart.schedRow!.canvasRestore(context); + }; + SpSegmentationChart.trace.rowsEL?.appendChild(SpSegmentationChart.schedRow); + this.rowFolder!.addChildTraceRow(SpSegmentationChart.schedRow); + } + + async initBinderTrace() { + SpSegmentationChart.binderRow = TraceRow.skeleton(); + SpSegmentationChart.binderRow.rowId = `binderrow`; + SpSegmentationChart.binderRow.rowType = TraceRow.ROW_TYPE_BINDER_COUNT; + SpSegmentationChart.binderRow.rowParentId = ''; + SpSegmentationChart.binderRow.name = `Binder Count`; + SpSegmentationChart.binderRow.style.height = '40px'; + SpSegmentationChart.binderRow.favoriteChangeHandler = SpSegmentationChart.trace.favoriteChangeHandler; + SpSegmentationChart.binderRow.selectChangeHandler = SpSegmentationChart.trace.selectChangeHandler; + SpSegmentationChart.binderRow.findHoverStruct = () => { + BinderStruct.hoverCpuFreqStruct = SpSegmentationChart.binderRow!.dataListCache.find((v: any) => { + if (SpSegmentationChart.binderRow!.isHover) { + if (v.frame.x < SpSegmentationChart.binderRow!.hoverX + && v.frame.x + v.frame.width > SpSegmentationChart.binderRow!.hoverX + && (BinderStruct.maxHeight * 20 - v.depth * 20 + 20) < SpSegmentationChart.binderRow!.hoverY + && BinderStruct.maxHeight * 20 - v.depth * 20 + v.value * 20 + 20 > SpSegmentationChart.binderRow!.hoverY) { + return v + } + } + }) + }; + SpSegmentationChart.binderRow.supplier = (): Promise> => + new Promise>((resolve) => resolve([])); + SpSegmentationChart.binderRow.onThreadHandler = (useCache) => { + let context: CanvasRenderingContext2D; + if (SpSegmentationChart.binderRow!.currentContext) { + context = SpSegmentationChart.binderRow!.currentContext; + } else { + context = SpSegmentationChart.binderRow!.collect ? SpSegmentationChart.trace.canvasFavoritePanelCtx! : SpSegmentationChart.trace.canvasPanelCtx!; + } + SpSegmentationChart.binderRow!.canvasSave(context); + (renders['binder'] as BinderRender).renderMainThread( + { + context: context, + useCache: useCache, + type: `binder`, + }, + SpSegmentationChart.binderRow! + ); + SpSegmentationChart.binderRow!.canvasRestore(context); + }; + SpSegmentationChart.binderRow.focusHandler = (ev) => { + SpSegmentationChart.trace!.displayTip( + SpSegmentationChart.binderRow!, + BinderStruct.hoverCpuFreqStruct, + `Cycle: ${BinderStruct.hoverCpuFreqStruct ? BinderStruct.hoverCpuFreqStruct.cycle : 0}
+ Name: ${BinderStruct.hoverCpuFreqStruct ? BinderStruct.hoverCpuFreqStruct.name : ''}
+ Count: ${BinderStruct.hoverCpuFreqStruct ? BinderStruct.hoverCpuFreqStruct.value : 0}` + ); + }; + SpSegmentationChart.trace.rowsEL?.appendChild(SpSegmentationChart.binderRow); + this.rowFolder!.addChildTraceRow(SpSegmentationChart.binderRow); + } + +} + +class FreqChartDataStruct { + cpu?: number = 0; + dur: number = 0; + value: number = 0; + startNS: number = 0; + cycle: number = 0; + freq?: number = 0; + type?: string = ''; + count?: number = 0; +} + +class BinderDataStruct { + name: string = ''; + count: number = 0; + dur: number = 0; + startNS: number = 0; + idx: number = -1; + depth?: number = 0; +} + +function setCpuData(data: Array, currentMaxValue: number, type: string) { + let chartData = data.map((v: FreqChartDataStruct) => { + if (v.value > currentMaxValue) { + currentMaxValue = v.value + } + return { + cpu: 0, + dur: v.dur, + value: v.value ? v.value : v.count ? v.count : 0, + startNS: v.startNS, + cycle: v.cycle, + type + } + }) + CpuFreqExtendStruct.maxValue = currentMaxValue; + SpSegmentationChart.jsonRow!.dataList = []; + SpSegmentationChart.jsonRow!.dataListCache = []; + SpSegmentationChart.jsonRow!.isComplete = false; + // @ts-ignore + SpSegmentationChart.jsonRow!.supplier = (): Promise> => + new Promise>((resolve) => resolve(chartData)); +} + +function setGpuData(data: Array, currentMaxValue: number, type: string) { + let chartData = data.map((v: FreqChartDataStruct) => { + let _count = Number(v.count) + if (_count > currentMaxValue) { + currentMaxValue = _count + } + return { + cpu: 7, + dur: v.dur ? Number(v.dur * 1000000) : 0, + value: Number(v.count), + startNS: Number(v.startNS), + cycle: Number(v.cycle), + type + } + }) + CpuFreqExtendStruct.maxValue = currentMaxValue; + SpSegmentationChart.GpuRow!.dataList = []; + SpSegmentationChart.GpuRow!.dataListCache = []; + SpSegmentationChart.GpuRow!.isComplete = false; + // @ts-ignore + SpSegmentationChart.GpuRow!.supplier = (): Promise> => + new Promise>((resolve) => resolve(chartData)); +} + +function setSchedData(data: Array, currentMaxValue: number, type: string) { + let chartData = data.map((v: any) => { + if (v.count > currentMaxValue) { + currentMaxValue = v.count + } + return { + cpu: 5, + dur: Number(v.duration) * 1000000, + value: v.count, + startNS: Number(v.cycleStartTime) * 1000000, + cycle: v.cycle, + type + } + }) + CpuFreqExtendStruct.maxValue = currentMaxValue; + SpSegmentationChart.schedRow!.dataList = []; + SpSegmentationChart.schedRow!.dataListCache = []; + SpSegmentationChart.schedRow!.isComplete = false; + SpSegmentationChart.schedRow!.supplier = (): Promise> => + new Promise>((resolve) => resolve(chartData)); +} + +function setBinderData(data: Array>, binderList: Array) { + data.map((v: Array) => { + let listCount = 0 + v.map((t: BinderDataStruct) => { + listCount += t.count; + if (t.name === 'binder transaction') { + t.depth = t.count; + } + if (t.name === 'binder transaction async') { + t.depth = t.count + ((v.filter((i: BinderDataStruct) => { + return i.name === 'binder transaction'; + }).length > 0) ? (v.filter((i: BinderDataStruct) => { + return i.name === 'binder transaction'; + })[0].count) : 0); + } + if (t.name === 'binder reply') { + t.depth = t.count + ((v.filter((i: BinderDataStruct) => { + return i.name === 'binder transaction'; + }).length > 0) ? (v.filter((i: BinderDataStruct) => { + return i.name === 'binder transaction'; + })[0].count) : 0) + ((v.filter((i: BinderDataStruct) => { + return i.name === 'binder transaction async'; + }).length > 0) ? (v.filter((i: BinderDataStruct) => { + return i.name === 'binder transaction async'; + })[0].count) : 0); + } + if (t.name === 'binder async rcv') { + t.depth = t.count + ((v.filter((i: BinderDataStruct) => { + return i.name === 'binder transaction'; + }).length > 0) ? (v.filter((i: BinderDataStruct) => { + return i.name === 'binder transaction'; + })[0].count) : 0) + ((v.filter((i: BinderDataStruct) => { + return i.name === 'binder transaction async'; + }).length > 0) ? (v.filter((i: BinderDataStruct) => { + return i.name === 'binder transaction async'; + })[0].count) : 0) + ((v.filter((i: BinderDataStruct) => { + return i.name === 'binder reply'; + }).length > 0) ? (v.filter((i: BinderDataStruct) => { + return i.name === 'binder reply'; + })[0].count) : 0); + } + binderList.push(t); + }); + BinderStruct.maxHeight = BinderStruct.maxHeight > listCount ? BinderStruct.maxHeight : JSON.parse(JSON.stringify(listCount)); + listCount = 0; + }) +} \ No newline at end of file diff --git a/ide/src/trace/database/ui-worker/ProcedureWorkerFreqExtend.ts b/ide/src/trace/database/ui-worker/ProcedureWorkerFreqExtend.ts new file mode 100644 index 000000000..871fd6966 --- /dev/null +++ b/ide/src/trace/database/ui-worker/ProcedureWorkerFreqExtend.ts @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ColorUtils } from '../../component/trace/base/ColorUtils'; +import { BaseStruct, dataFilterHandler, isFrameContainPoint, Render, RequestMessage } from './ProcedureWorkerCommon'; +import { TraceRow } from '../../component/trace/base/TraceRow'; + +export class FreqExtendRender extends Render { + renderMainThread( + freqReq: { + context: CanvasRenderingContext2D; + useCache: boolean; + type: string; + }, + row: TraceRow + ) { + let freqList = row.dataList; + let freqFilter = row.dataListCache; + dataFilterHandler(freqList, freqFilter, { + startKey: 'startNS', + durKey: 'dur', + startNS: TraceRow.range?.startNS ?? 0, + endNS: TraceRow.range?.endNS ?? 0, + totalNS: TraceRow.range?.totalNS ?? 0, + frame: row.frame, + paddingTop: 5, + useCache: freqReq.useCache || !(TraceRow.range?.refresh ?? false), + }); + + if (row.isHover) { + CpuFreqExtendStruct.cycle = -1; + CpuFreqExtendStruct.isTabHover = false; + } + freqReq.context.beginPath(); + for (let re of freqFilter) { + if (row.isHover && re.frame && isFrameContainPoint(re.frame, row.hoverX, row.hoverY)) { + CpuFreqExtendStruct.hoverCpuFreqStruct = re; + } + if (!row.isHover && !CpuFreqExtendStruct.isTabHover) CpuFreqExtendStruct.hoverCpuFreqStruct = undefined; + CpuFreqExtendStruct.draw(freqReq.context, re); + } + freqReq.context.closePath(); + } +} + +export class CpuFreqExtendStruct extends BaseStruct { + static maxValue: number = 0; + static cycle: number = -1; + static isTabHover: boolean = false; + static hoverCpuFreqStruct: CpuFreqExtendStruct | undefined; + freq: number = 0; + static selectCpuFreqStruct: CpuFreqExtendStruct | undefined; + cpu: number | undefined; + value: number = 0; + startNS: number | undefined; + dur: number | undefined; //自补充,数据库没有返回 + cycle: number | undefined; + type: string | undefined; + count:number = 0; + + static draw(freqContext: CanvasRenderingContext2D, data: CpuFreqExtendStruct) { + if (data.frame) { + let width = data.frame.width || 0; + let index = data.cpu || 0; + index += 2; + let color = ColorUtils.colorForTid(index) + freqContext.fillStyle = color; + freqContext.strokeStyle = color; + if (data === CpuFreqExtendStruct.hoverCpuFreqStruct + || data === CpuFreqExtendStruct.selectCpuFreqStruct + || data === CpuFreqExtendStruct.selectCpuFreqStruct + || (data.cycle === CpuFreqExtendStruct.cycle + && CpuFreqExtendStruct.cycle !== -1)) { + freqContext.fillStyle = '#ff0000'; + freqContext.strokeStyle = '#ff0000'; + freqContext.lineWidth = 3; + freqContext.globalAlpha = 0.6; + if (data.type === 'SCHED-SWITCH' || data.type === 'GPU-FREQ') { + freqContext.globalAlpha = 1; + freqContext.fillStyle = color; + freqContext.strokeStyle = color; + } + let drawHeight: number = Math.floor( + ((data.value || 0) * (data.frame.height || 0) * 1.0) / CpuFreqExtendStruct.maxValue + ); + if (drawHeight < 1) { + drawHeight = 1; + } + freqContext.fillRect(data.frame.x, data.frame.y + data.frame.height - drawHeight, width, drawHeight); + freqContext.globalAlpha = 0.8; + freqContext.strokeRect(data.frame.x, data.frame.y + data.frame.height - drawHeight, width, drawHeight); + } else { + freqContext.globalAlpha = 0.6; + freqContext.lineWidth = 1; + let drawHeight: number = Math.floor(((data.value || 0) * (data.frame.height || 0)) / CpuFreqExtendStruct.maxValue); + if (drawHeight < 1) { + drawHeight = 1; + } + freqContext.fillRect(data.frame.x, data.frame.y + data.frame.height - drawHeight, width, drawHeight); + } + } + freqContext.globalAlpha = 1.0; + freqContext.lineWidth = 1; + } +} diff --git a/ide/src/trace/database/ui-worker/procedureWorkerBinder.ts b/ide/src/trace/database/ui-worker/procedureWorkerBinder.ts new file mode 100644 index 000000000..a36bda5e0 --- /dev/null +++ b/ide/src/trace/database/ui-worker/procedureWorkerBinder.ts @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { ColorUtils } from '../../component/trace/base/ColorUtils'; +import { BaseStruct, dataFilterHandler, isFrameContainPoint, Render, RequestMessage } from './ProcedureWorkerCommon'; +import { TraceRow } from '../../component/trace/base/TraceRow'; +import { drawString, Rect } from './ProcedureWorkerCommon'; + +export class BinderRender extends Render { + renderMainThread( + freqReq: { + context: CanvasRenderingContext2D; + useCache: boolean; + type: string; + }, + row: TraceRow + ) { + let freqList = row.dataList; + let freqFilter = row.dataListCache; + dataFilterHandler(freqList, freqFilter, { + startKey: 'startNS', + durKey: 'dur', + startNS: TraceRow.range?.startNS ?? 0, + endNS: TraceRow.range?.endNS ?? 0, + totalNS: TraceRow.range?.totalNS ?? 0, + frame: row.frame, + paddingTop: 5, + useCache: freqReq.useCache || !(TraceRow.range?.refresh ?? false), + }); + freqReq.context.beginPath(); + for (let re of freqFilter) { + if (row.isHover && re.frame && isFrameContainPoint(re.frame, row.hoverX, row.hoverY)) { + BinderStruct.hoverCpuFreqStruct = re; + } + if (!row.isHover) { + BinderStruct.hoverCpuFreqStruct = undefined; + } + BinderStruct.draw(freqReq.context, re); + } + freqReq.context.closePath(); + } +} +export class BinderStruct extends BaseStruct { + static hoverCpuFreqStruct: BinderStruct | undefined; + static selectCpuFreqStruct: BinderStruct | undefined; + static maxHeight: number = 0; + static hoverCycle: number = -1; + cpu: number | undefined; + value: number = 0; + cycle: number = 0; + startNS: number | undefined; + dur: number | undefined; //自补充,数据库没有返回 + name: string | undefined; + depth: number = 0; + static draw(freqContext: CanvasRenderingContext2D, data: BinderStruct) { + if (data.frame) { + let index = data.cpu || 0; + let color = ''; + if (data.name === 'binder transaction') { + color = '#e86b6a'; + } + if (data.name === 'binder transaction async') { + color = '#36baa4'; + } + if (data.name === 'binder reply') { + color = '#8770d3'; + } + if (data.name === 'binder async rcv') { + color = '#0cbdd4'; + } + freqContext.fillStyle = color + if (data === BinderStruct.hoverCpuFreqStruct || data === BinderStruct.selectCpuFreqStruct || data.cycle === BinderStruct.hoverCycle) { + freqContext.globalAlpha = 1; + freqContext.lineWidth = 1; + freqContext.fillRect(data.frame.x, BinderStruct.maxHeight * 20 - data.depth * 20 + 20, data.frame.width, data.value * 20); + } else { + freqContext.globalAlpha = 0.6; + freqContext.lineWidth = 1; + freqContext.fillRect(data.frame.x, BinderStruct.maxHeight * 20 - data.depth * 20 + 20, data.frame.width, data.value * 20); + } + if (data.frame.width > 8) { + freqContext.lineWidth = 1; + freqContext.fillStyle = ColorUtils.funcTextColor( + ColorUtils.FUNC_COLOR[ColorUtils.hashFunc(data.name || '', 0, ColorUtils.FUNC_COLOR.length)] + ); + freqContext.textBaseline = 'middle'; + drawString(freqContext, `${data.name || ''}`, 6, new Rect(data.frame.x, BinderStruct.maxHeight * 20 - data.depth * 20 + 20, data.frame.width, data.value * 20), data); + } + freqContext.globalAlpha = 1.0; + freqContext.lineWidth = 1; + } + } +} \ No newline at end of file -- Gitee From e7793feaf686932841da04063c80c7b9e2643391 Mon Sep 17 00:00:00 2001 From: liufei Date: Thu, 14 Dec 2023 18:50:54 +0800 Subject: [PATCH 3/5] =?UTF-8?q?helpdocument=E6=8A=98=E5=8F=A0=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=EF=BC=8Chiperfcallchart=E9=BB=98=E8=AE=A4=E6=94=B6?= =?UTF-8?q?=E8=B5=B7=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=9B=9B=E6=9D=A1=E6=B3=B3?= =?UTF-8?q?=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liufei --- ide/src/trace/component/chart/SpSegmentationChart.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ide/src/trace/component/chart/SpSegmentationChart.ts b/ide/src/trace/component/chart/SpSegmentationChart.ts index a3fd22397..c2baf08f7 100644 --- a/ide/src/trace/component/chart/SpSegmentationChart.ts +++ b/ide/src/trace/component/chart/SpSegmentationChart.ts @@ -33,7 +33,7 @@ export class SpSegmentationChart { private rowFolder!: TraceRow; static chartData: Array = [];; // 数据切割联动 - static setChartData(type: string, data: Array) { + static setChartData(type: string, data: Array): void { let currentMaxValue: number = 0; if (type === 'CPU-FREQ') { setCpuData(data, currentMaxValue, type); @@ -47,7 +47,7 @@ export class SpSegmentationChart { } // binder联动调用 - static setBinderChartData(type: string, data: Array>) { + static setBinderChartData(type: string, data: Array>): void { BinderStruct.maxHeight = 0; let binderList: Array = []; let chartData: Array = []; @@ -78,7 +78,7 @@ export class SpSegmentationChart { } // 悬浮联动 - static tabHover(type: String, tableIsHover: boolean = false, cycle: number = -1) { + static tabHover(type: String, tableIsHover: boolean = false, cycle: number = -1): void { CpuFreqExtendStruct.isTabHover = tableIsHover; if (type === 'CPU-FREQ' || type === 'GPU-FREQ' || type === 'SCHED-SWITCH') { if (tableIsHover) { @@ -396,7 +396,7 @@ function setCpuData(data: Array, currentMaxValue: number, t new Promise>((resolve) => resolve(chartData)); } -function setGpuData(data: Array, currentMaxValue: number, type: string) { +function setGpuData(data: Array, currentMaxValue: number, type: string): void { let chartData = data.map((v: FreqChartDataStruct) => { let _count = Number(v.count) if (_count > currentMaxValue) { @@ -420,7 +420,7 @@ function setGpuData(data: Array, currentMaxValue: number, t new Promise>((resolve) => resolve(chartData)); } -function setSchedData(data: Array, currentMaxValue: number, type: string) { +function setSchedData(data: Array, currentMaxValue: number, type: string): void { let chartData = data.map((v: any) => { if (v.count > currentMaxValue) { currentMaxValue = v.count @@ -442,7 +442,7 @@ function setSchedData(data: Array, currentMaxValue: number, new Promise>((resolve) => resolve(chartData)); } -function setBinderData(data: Array>, binderList: Array) { +function setBinderData(data: Array>, binderList: Array): void { data.map((v: Array) => { let listCount = 0 v.map((t: BinderDataStruct) => { -- Gitee From 9253817c73e81e07940a092940ddc1906410c356 Mon Sep 17 00:00:00 2001 From: liufei Date: Fri, 15 Dec 2023 09:37:21 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liufei --- .../trace/component/chart/SpSegmentationChart.ts | 14 +++++++------- .../database/ui-worker/procedureWorkerBinder.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ide/src/trace/component/chart/SpSegmentationChart.ts b/ide/src/trace/component/chart/SpSegmentationChart.ts index c2baf08f7..13aee0ba5 100644 --- a/ide/src/trace/component/chart/SpSegmentationChart.ts +++ b/ide/src/trace/component/chart/SpSegmentationChart.ts @@ -225,7 +225,7 @@ export class SpSegmentationChart { SpSegmentationChart.trace?.displayTip( SpSegmentationChart.GpuRow!, CpuFreqExtendStruct.hoverCpuFreqStruct, - `${CpuFreqExtendStruct.hoverCpuFreqStruct === undefined ? 0 : CpuFreqExtendStruct.hoverCpuFreqStruct.value!} Hz·ms` + `${CpuFreqExtendStruct.hoverCpuFreqStruct === undefined ? 0 : CpuFreqExtendStruct.hoverCpuFreqStruct.value!}` ); }; SpSegmentationChart.GpuRow.findHoverStruct = () => { @@ -266,7 +266,7 @@ export class SpSegmentationChart { SpSegmentationChart.trace?.displayTip( SpSegmentationChart.schedRow!, CpuFreqExtendStruct.hoverCpuFreqStruct, - `${ColorUtils.formatNumberComma(CpuFreqExtendStruct.hoverCpuFreqStruct?.value!)} Hz·ms` + `${CpuFreqExtendStruct.hoverCpuFreqStruct?.value!}` ); }; SpSegmentationChart.schedRow.findHoverStruct = () => { @@ -313,7 +313,7 @@ export class SpSegmentationChart { && v.frame.x + v.frame.width > SpSegmentationChart.binderRow!.hoverX && (BinderStruct.maxHeight * 20 - v.depth * 20 + 20) < SpSegmentationChart.binderRow!.hoverY && BinderStruct.maxHeight * 20 - v.depth * 20 + v.value * 20 + 20 > SpSegmentationChart.binderRow!.hoverY) { - return v + return v; } } }) @@ -376,7 +376,7 @@ class BinderDataStruct { function setCpuData(data: Array, currentMaxValue: number, type: string) { let chartData = data.map((v: FreqChartDataStruct) => { if (v.value > currentMaxValue) { - currentMaxValue = v.value + currentMaxValue = v.value; } return { cpu: 0, @@ -400,7 +400,7 @@ function setGpuData(data: Array, currentMaxValue: number, t let chartData = data.map((v: FreqChartDataStruct) => { let _count = Number(v.count) if (_count > currentMaxValue) { - currentMaxValue = _count + currentMaxValue = _count; } return { cpu: 7, @@ -423,7 +423,7 @@ function setGpuData(data: Array, currentMaxValue: number, t function setSchedData(data: Array, currentMaxValue: number, type: string): void { let chartData = data.map((v: any) => { if (v.count > currentMaxValue) { - currentMaxValue = v.count + currentMaxValue = v.count; } return { cpu: 5, @@ -444,7 +444,7 @@ function setSchedData(data: Array, currentMaxValue: number, function setBinderData(data: Array>, binderList: Array): void { data.map((v: Array) => { - let listCount = 0 + let listCount = 0; v.map((t: BinderDataStruct) => { listCount += t.count; if (t.name === 'binder transaction') { diff --git a/ide/src/trace/database/ui-worker/procedureWorkerBinder.ts b/ide/src/trace/database/ui-worker/procedureWorkerBinder.ts index a36bda5e0..8996d8ead 100644 --- a/ide/src/trace/database/ui-worker/procedureWorkerBinder.ts +++ b/ide/src/trace/database/ui-worker/procedureWorkerBinder.ts @@ -80,7 +80,7 @@ export class BinderStruct extends BaseStruct { if (data.name === 'binder async rcv') { color = '#0cbdd4'; } - freqContext.fillStyle = color + freqContext.fillStyle = color; if (data === BinderStruct.hoverCpuFreqStruct || data === BinderStruct.selectCpuFreqStruct || data.cycle === BinderStruct.hoverCycle) { freqContext.globalAlpha = 1; freqContext.lineWidth = 1; -- Gitee From 9fa214c4668991eef61b8e6ffa84a6fab811afc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9F=B3=E6=96=90?= Date: Fri, 15 Dec 2023 01:47:59 +0000 Subject: [PATCH 5/5] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20ide/?= =?UTF-8?q?test/bin/trace=5Fconverter=5Fbuiltin.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ide/test/bin/trace_converter_builtin.js | 2494 ----------------------- 1 file changed, 2494 deletions(-) delete mode 100644 ide/test/bin/trace_converter_builtin.js diff --git a/ide/test/bin/trace_converter_builtin.js b/ide/test/bin/trace_converter_builtin.js deleted file mode 100644 index ef6907703..000000000 --- a/ide/test/bin/trace_converter_builtin.js +++ /dev/null @@ -1,2494 +0,0 @@ - -var trace_converter_builtin_wasm = (() => { - var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; - if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; - return ( -function(trace_converter_builtin_wasm) { - trace_converter_builtin_wasm = trace_converter_builtin_wasm || {}; - -var Module = typeof trace_converter_builtin_wasm != "undefined" ? trace_converter_builtin_wasm : {}; - -var readyPromiseResolve, readyPromiseReject; - -Module["ready"] = new Promise(function(resolve, reject) { - readyPromiseResolve = resolve; - readyPromiseReject = reject; -}); - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_free")) { - Object.defineProperty(Module["ready"], "_free", { - configurable: true, - get: function() { - abort("You are getting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_free", { - configurable: true, - set: function() { - abort("You are setting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_malloc")) { - Object.defineProperty(Module["ready"], "_malloc", { - configurable: true, - get: function() { - abort("You are getting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_malloc", { - configurable: true, - set: function() { - abort("You are setting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_GetFinalHeader")) { - Object.defineProperty(Module["ready"], "_GetFinalHeader", { - configurable: true, - get: function() { - abort("You are getting _GetFinalHeader on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_GetFinalHeader", { - configurable: true, - set: function() { - abort("You are setting _GetFinalHeader on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_GetTraceConverterIns")) { - Object.defineProperty(Module["ready"], "_GetTraceConverterIns", { - configurable: true, - get: function() { - abort("You are getting _GetTraceConverterIns on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_GetTraceConverterIns", { - configurable: true, - set: function() { - abort("You are setting _GetTraceConverterIns on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_ReleaseTraceConverterIns")) { - Object.defineProperty(Module["ready"], "_ReleaseTraceConverterIns", { - configurable: true, - get: function() { - abort("You are getting _ReleaseTraceConverterIns on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_ReleaseTraceConverterIns", { - configurable: true, - set: function() { - abort("You are setting _ReleaseTraceConverterIns on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_SetDebugFlag")) { - Object.defineProperty(Module["ready"], "_SetDebugFlag", { - configurable: true, - get: function() { - abort("You are getting _SetDebugFlag on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_SetDebugFlag", { - configurable: true, - set: function() { - abort("You are setting _SetDebugFlag on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_ConvertBlockData")) { - Object.defineProperty(Module["ready"], "_ConvertBlockData", { - configurable: true, - get: function() { - abort("You are getting _ConvertBlockData on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_ConvertBlockData", { - configurable: true, - set: function() { - abort("You are setting _ConvertBlockData on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_SendFileHeader")) { - Object.defineProperty(Module["ready"], "_SendFileHeader", { - configurable: true, - get: function() { - abort("You are getting _SendFileHeader on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_SendFileHeader", { - configurable: true, - set: function() { - abort("You are setting _SendFileHeader on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_SetCallback")) { - Object.defineProperty(Module["ready"], "_SetCallback", { - configurable: true, - get: function() { - abort("You are getting _SetCallback on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_SetCallback", { - configurable: true, - set: function() { - abort("You are setting _SetCallback on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_GetRemainingData")) { - Object.defineProperty(Module["ready"], "_GetRemainingData", { - configurable: true, - get: function() { - abort("You are getting _GetRemainingData on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_GetRemainingData", { - configurable: true, - set: function() { - abort("You are setting _GetRemainingData on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_SendRawFileHeader")) { - Object.defineProperty(Module["ready"], "_SendRawFileHeader", { - configurable: true, - get: function() { - abort("You are getting _SendRawFileHeader on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_SendRawFileHeader", { - configurable: true, - set: function() { - abort("You are setting _SendRawFileHeader on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_ConvertRawBlockData")) { - Object.defineProperty(Module["ready"], "_ConvertRawBlockData", { - configurable: true, - get: function() { - abort("You are getting _ConvertRawBlockData on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_ConvertRawBlockData", { - configurable: true, - set: function() { - abort("You are setting _ConvertRawBlockData on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "_fflush")) { - Object.defineProperty(Module["ready"], "_fflush", { - configurable: true, - get: function() { - abort("You are getting _fflush on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "_fflush", { - configurable: true, - set: function() { - abort("You are setting _fflush on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -if (!Object.getOwnPropertyDescriptor(Module["ready"], "onRuntimeInitialized")) { - Object.defineProperty(Module["ready"], "onRuntimeInitialized", { - configurable: true, - get: function() { - abort("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); - Object.defineProperty(Module["ready"], "onRuntimeInitialized", { - configurable: true, - set: function() { - abort("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js"); - } - }); -} - -var moduleOverrides = Object.assign({}, Module); - -var arguments_ = []; - -var thisProgram = "./this.program"; - -var quit_ = (status, toThrow) => { - throw toThrow; -}; - -var ENVIRONMENT_IS_WEB = typeof window == "object"; - -var ENVIRONMENT_IS_WORKER = typeof importScripts == "function"; - -var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string"; - -var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER; - -if (Module["ENVIRONMENT"]) { - throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)"); -} - -var scriptDirectory = ""; - -function locateFile(path) { - if (Module["locateFile"]) { - return Module["locateFile"](path, scriptDirectory); - } - return scriptDirectory + path; -} - -var read_, readAsync, readBinary, setWindowTitle; - -function logExceptionOnExit(e) { - if (e instanceof ExitStatus) return; - let toLog = e; - if (e && typeof e == "object" && e.stack) { - toLog = [ e, e.stack ]; - } - err("exiting due to exception: " + toLog); -} - -var fs; - -var nodePath; - -var requireNodeFS; - -if (ENVIRONMENT_IS_NODE) { - if (!(typeof process == "object" && typeof require == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); - if (ENVIRONMENT_IS_WORKER) { - scriptDirectory = require("path").dirname(scriptDirectory) + "/"; - } else { - scriptDirectory = __dirname + "/"; - } - requireNodeFS = () => { - if (!nodePath) { - fs = require("fs"); - nodePath = require("path"); - } - }; - read_ = function shell_read(filename, binary) { - requireNodeFS(); - filename = nodePath["normalize"](filename); - return fs.readFileSync(filename, binary ? undefined : "utf8"); - }; - readBinary = filename => { - var ret = read_(filename, true); - if (!ret.buffer) { - ret = new Uint8Array(ret); - } - assert(ret.buffer); - return ret; - }; - readAsync = (filename, onload, onerror) => { - requireNodeFS(); - filename = nodePath["normalize"](filename); - fs.readFile(filename, function(err, data) { - if (err) onerror(err); else onload(data.buffer); - }); - }; - if (process["argv"].length > 1) { - thisProgram = process["argv"][1].replace(/\\/g, "/"); - } - arguments_ = process["argv"].slice(2); - process["on"]("uncaughtException", function(ex) { - if (!(ex instanceof ExitStatus)) { - throw ex; - } - }); - process["on"]("unhandledRejection", function(reason) { - throw reason; - }); - quit_ = (status, toThrow) => { - if (keepRuntimeAlive()) { - process["exitCode"] = status; - throw toThrow; - } - logExceptionOnExit(toThrow); - process["exit"](status); - }; - Module["inspect"] = function() { - return "[Emscripten Module object]"; - }; -} else if (ENVIRONMENT_IS_SHELL) { - if (typeof process == "object" && typeof require === "function" || typeof window == "object" || typeof importScripts == "function") throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); - if (typeof read != "undefined") { - read_ = function shell_read(f) { - return read(f); - }; - } - readBinary = function readBinary(f) { - let data; - if (typeof readbuffer == "function") { - return new Uint8Array(readbuffer(f)); - } - data = read(f, "binary"); - assert(typeof data == "object"); - return data; - }; - readAsync = function readAsync(f, onload, onerror) { - setTimeout(() => onload(readBinary(f)), 0); - }; - if (typeof scriptArgs != "undefined") { - arguments_ = scriptArgs; - } else if (typeof arguments != "undefined") { - arguments_ = arguments; - } - if (typeof quit == "function") { - quit_ = (status, toThrow) => { - logExceptionOnExit(toThrow); - quit(status); - }; - } - if (typeof print != "undefined") { - if (typeof console == "undefined") console = {}; - console.log = print; - console.warn = console.error = typeof printErr != "undefined" ? printErr : print; - } -} else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) { - if (ENVIRONMENT_IS_WORKER) { - scriptDirectory = self.location.href; - } else if (typeof document != "undefined" && document.currentScript) { - scriptDirectory = document.currentScript.src; - } - if (_scriptDir) { - scriptDirectory = _scriptDir; - } - if (scriptDirectory.indexOf("blob:") !== 0) { - scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1); - } else { - scriptDirectory = ""; - } - if (!(typeof window == "object" || typeof importScripts == "function")) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)"); - { - read_ = url => { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, false); - xhr.send(null); - return xhr.responseText; - }; - if (ENVIRONMENT_IS_WORKER) { - readBinary = url => { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, false); - xhr.responseType = "arraybuffer"; - xhr.send(null); - return new Uint8Array(xhr.response); - }; - } - readAsync = (url, onload, onerror) => { - var xhr = new XMLHttpRequest(); - xhr.open("GET", url, true); - xhr.responseType = "arraybuffer"; - xhr.onload = () => { - if (xhr.status == 200 || xhr.status == 0 && xhr.response) { - onload(xhr.response); - return; - } - onerror(); - }; - xhr.onerror = onerror; - xhr.send(null); - }; - } - setWindowTitle = title => document.title = title; -} else { - throw new Error("environment detection error"); -} - -var out = Module["print"] || console.log.bind(console); - -var err = Module["printErr"] || console.warn.bind(console); - -Object.assign(Module, moduleOverrides); - -moduleOverrides = null; - -checkIncomingModuleAPI(); - -if (Module["arguments"]) arguments_ = Module["arguments"]; - -legacyModuleProp("arguments", "arguments_"); - -if (Module["thisProgram"]) thisProgram = Module["thisProgram"]; - -legacyModuleProp("thisProgram", "thisProgram"); - -if (Module["quit"]) quit_ = Module["quit"]; - -legacyModuleProp("quit", "quit_"); - -assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"); - -assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"); - -assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"); - -assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead"); - -assert(typeof Module["read"] == "undefined", "Module.read option was removed (modify read_ in JS)"); - -assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)"); - -assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)"); - -assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify setWindowTitle in JS)"); - -assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"); - -legacyModuleProp("read", "read_"); - -legacyModuleProp("readAsync", "readAsync"); - -legacyModuleProp("readBinary", "readBinary"); - -legacyModuleProp("setWindowTitle", "setWindowTitle"); - -assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable."); - -var POINTER_SIZE = 4; - -function warnOnce(text) { - if (!warnOnce.shown) warnOnce.shown = {}; - if (!warnOnce.shown[text]) { - warnOnce.shown[text] = 1; - err(text); - } -} - -function uleb128Encode(n) { - assert(n < 16384); - if (n < 128) { - return [ n ]; - } - return [ n % 128 | 128, n >> 7 ]; -} - -function convertJsFunctionToWasm(func, sig) { - if (typeof WebAssembly.Function == "function") { - var typeNames = { - "i": "i32", - "j": "i64", - "f": "f32", - "d": "f64", - "p": "i32" - }; - var type = { - parameters: [], - results: sig[0] == "v" ? [] : [ typeNames[sig[0]] ] - }; - for (var i = 1; i < sig.length; ++i) { - assert(sig[i] in typeNames, "invalid signature char: " + sig[i]); - type.parameters.push(typeNames[sig[i]]); - } - return new WebAssembly.Function(type, func); - } - var typeSection = [ 1, 96 ]; - var sigRet = sig.slice(0, 1); - var sigParam = sig.slice(1); - var typeCodes = { - "i": 127, - "p": 127, - "j": 126, - "f": 125, - "d": 124 - }; - typeSection = typeSection.concat(uleb128Encode(sigParam.length)); - for (var i = 0; i < sigParam.length; ++i) { - assert(sigParam[i] in typeCodes, "invalid signature char: " + sigParam[i]); - typeSection.push(typeCodes[sigParam[i]]); - } - if (sigRet == "v") { - typeSection.push(0); - } else { - typeSection = typeSection.concat([ 1, typeCodes[sigRet] ]); - } - typeSection = [ 1 ].concat(uleb128Encode(typeSection.length), typeSection); - var bytes = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0 ].concat(typeSection, [ 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0 ])); - var module = new WebAssembly.Module(bytes); - var instance = new WebAssembly.Instance(module, { - "e": { - "f": func - } - }); - var wrappedFunc = instance.exports["f"]; - return wrappedFunc; -} - -var freeTableIndexes = []; - -var functionsInTableMap; - -function getEmptyTableSlot() { - if (freeTableIndexes.length) { - return freeTableIndexes.pop(); - } - try { - wasmTable.grow(1); - } catch (err) { - if (!(err instanceof RangeError)) { - throw err; - } - throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."; - } - return wasmTable.length - 1; -} - -function updateTableMap(offset, count) { - for (var i = offset; i < offset + count; i++) { - var item = getWasmTableEntry(i); - if (item) { - functionsInTableMap.set(item, i); - } - } -} - -function addFunction(func, sig) { - assert(typeof func != "undefined"); - if (!functionsInTableMap) { - functionsInTableMap = new WeakMap(); - updateTableMap(0, wasmTable.length); - } - if (functionsInTableMap.has(func)) { - return functionsInTableMap.get(func); - } - var ret = getEmptyTableSlot(); - try { - setWasmTableEntry(ret, func); - } catch (err) { - if (!(err instanceof TypeError)) { - throw err; - } - assert(typeof sig != "undefined", "Missing signature argument to addFunction: " + func); - var wrapped = convertJsFunctionToWasm(func, sig); - setWasmTableEntry(ret, wrapped); - } - functionsInTableMap.set(func, ret); - return ret; -} - -function legacyModuleProp(prop, newName) { - if (!Object.getOwnPropertyDescriptor(Module, prop)) { - Object.defineProperty(Module, prop, { - configurable: true, - get: function() { - abort("Module." + prop + " has been replaced with plain " + newName + " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)"); - } - }); - } -} - -function ignoredModuleProp(prop) { - if (Object.getOwnPropertyDescriptor(Module, prop)) { - abort("`Module." + prop + "` was supplied but `" + prop + "` not included in INCOMING_MODULE_JS_API"); - } -} - -function unexportedMessage(sym, isFSSybol) { - var msg = "'" + sym + "' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)"; - if (isFSSybol) { - msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"; - } - return msg; -} - -function unexportedRuntimeSymbol(sym, isFSSybol) { - if (!Object.getOwnPropertyDescriptor(Module, sym)) { - Object.defineProperty(Module, sym, { - configurable: true, - get: function() { - abort(unexportedMessage(sym, isFSSybol)); - } - }); - } -} - -function unexportedRuntimeFunction(sym, isFSSybol) { - if (!Object.getOwnPropertyDescriptor(Module, sym)) { - Module[sym] = () => abort(unexportedMessage(sym, isFSSybol)); - } -} - -var tempRet0 = 0; - -var setTempRet0 = value => { - tempRet0 = value; -}; - -var wasmBinary; - -if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"]; - -legacyModuleProp("wasmBinary", "wasmBinary"); - -var noExitRuntime = Module["noExitRuntime"] || true; - -legacyModuleProp("noExitRuntime", "noExitRuntime"); - -if (typeof WebAssembly != "object") { - abort("no native wasm support detected"); -} - -var wasmMemory; - -var ABORT = false; - -var EXITSTATUS; - -function assert(condition, text) { - if (!condition) { - abort("Assertion failed" + (text ? ": " + text : "")); - } -} - -function getCFunc(ident) { - var func = Module["_" + ident]; - assert(func, "Cannot call unknown function " + ident + ", make sure it is exported"); - return func; -} - -function ccall(ident, returnType, argTypes, args, opts) { - var toC = { - "string": function(str) { - var ret = 0; - if (str !== null && str !== undefined && str !== 0) { - var len = (str.length << 2) + 1; - ret = stackAlloc(len); - stringToUTF8(str, ret, len); - } - return ret; - }, - "array": function(arr) { - var ret = stackAlloc(arr.length); - writeArrayToMemory(arr, ret); - return ret; - } - }; - function convertReturnValue(ret) { - if (returnType === "string") { - return UTF8ToString(ret); - } - if (returnType === "boolean") return Boolean(ret); - return ret; - } - var func = getCFunc(ident); - var cArgs = []; - var stack = 0; - assert(returnType !== "array", 'Return type should not be "array".'); - if (args) { - for (var i = 0; i < args.length; i++) { - var converter = toC[argTypes[i]]; - if (converter) { - if (stack === 0) stack = stackSave(); - cArgs[i] = converter(args[i]); - } else { - cArgs[i] = args[i]; - } - } - } - var ret = func.apply(null, cArgs); - function onDone(ret) { - if (stack !== 0) stackRestore(stack); - return convertReturnValue(ret); - } - ret = onDone(ret); - return ret; -} - -var ALLOC_STACK = 1; - -var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf8") : undefined; - -function UTF8ArrayToString(heapOrArray, idx, maxBytesToRead) { - var endIdx = idx + maxBytesToRead; - var endPtr = idx; - while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr; - if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) { - return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr)); - } else { - var str = ""; - while (idx < endPtr) { - var u0 = heapOrArray[idx++]; - if (!(u0 & 128)) { - str += String.fromCharCode(u0); - continue; - } - var u1 = heapOrArray[idx++] & 63; - if ((u0 & 224) == 192) { - str += String.fromCharCode((u0 & 31) << 6 | u1); - continue; - } - var u2 = heapOrArray[idx++] & 63; - if ((u0 & 240) == 224) { - u0 = (u0 & 15) << 12 | u1 << 6 | u2; - } else { - if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte 0x" + u0.toString(16) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!"); - u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63; - } - if (u0 < 65536) { - str += String.fromCharCode(u0); - } else { - var ch = u0 - 65536; - str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023); - } - } - } - return str; -} - -function UTF8ToString(ptr, maxBytesToRead) { - return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : ""; -} - -function stringToUTF8Array(str, heap, outIdx, maxBytesToWrite) { - if (!(maxBytesToWrite > 0)) return 0; - var startIdx = outIdx; - var endIdx = outIdx + maxBytesToWrite - 1; - for (var i = 0; i < str.length; ++i) { - var u = str.charCodeAt(i); - if (u >= 55296 && u <= 57343) { - var u1 = str.charCodeAt(++i); - u = 65536 + ((u & 1023) << 10) | u1 & 1023; - } - if (u <= 127) { - if (outIdx >= endIdx) break; - heap[outIdx++] = u; - } else if (u <= 2047) { - if (outIdx + 1 >= endIdx) break; - heap[outIdx++] = 192 | u >> 6; - heap[outIdx++] = 128 | u & 63; - } else if (u <= 65535) { - if (outIdx + 2 >= endIdx) break; - heap[outIdx++] = 224 | u >> 12; - heap[outIdx++] = 128 | u >> 6 & 63; - heap[outIdx++] = 128 | u & 63; - } else { - if (outIdx + 3 >= endIdx) break; - if (u > 1114111) warnOnce("Invalid Unicode code point 0x" + u.toString(16) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."); - heap[outIdx++] = 240 | u >> 18; - heap[outIdx++] = 128 | u >> 12 & 63; - heap[outIdx++] = 128 | u >> 6 & 63; - heap[outIdx++] = 128 | u & 63; - } - } - heap[outIdx] = 0; - return outIdx - startIdx; -} - -function stringToUTF8(str, outPtr, maxBytesToWrite) { - assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"); - return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite); -} - -function lengthBytesUTF8(str) { - var len = 0; - for (var i = 0; i < str.length; ++i) { - var u = str.charCodeAt(i); - if (u >= 55296 && u <= 57343) u = 65536 + ((u & 1023) << 10) | str.charCodeAt(++i) & 1023; - if (u <= 127) ++len; else if (u <= 2047) len += 2; else if (u <= 65535) len += 3; else len += 4; - } - return len; -} - -var UTF16Decoder = typeof TextDecoder != "undefined" ? new TextDecoder("utf-16le") : undefined; - -function allocateUTF8(str) { - var size = lengthBytesUTF8(str) + 1; - var ret = _malloc(size); - if (ret) stringToUTF8Array(str, HEAP8, ret, size); - return ret; -} - -function writeArrayToMemory(array, buffer) { - assert(array.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)"); - HEAP8.set(array, buffer); -} - -function writeAsciiToMemory(str, buffer, dontAddNull) { - for (var i = 0; i < str.length; ++i) { - assert(str.charCodeAt(i) === (str.charCodeAt(i) & 255)); - HEAP8[buffer++ >> 0] = str.charCodeAt(i); - } - if (!dontAddNull) HEAP8[buffer >> 0] = 0; -} - -var buffer, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64; - -function updateGlobalBufferAndViews(buf) { - buffer = buf; - Module["HEAP8"] = HEAP8 = new Int8Array(buf); - Module["HEAP16"] = HEAP16 = new Int16Array(buf); - Module["HEAP32"] = HEAP32 = new Int32Array(buf); - Module["HEAPU8"] = HEAPU8 = new Uint8Array(buf); - Module["HEAPU16"] = HEAPU16 = new Uint16Array(buf); - Module["HEAPU32"] = HEAPU32 = new Uint32Array(buf); - Module["HEAPF32"] = HEAPF32 = new Float32Array(buf); - Module["HEAPF64"] = HEAPF64 = new Float64Array(buf); -} - -var TOTAL_STACK = 5242880; - -if (Module["TOTAL_STACK"]) assert(TOTAL_STACK === Module["TOTAL_STACK"], "the stack size can no longer be determined at runtime"); - -var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 33554432; - -legacyModuleProp("INITIAL_MEMORY", "INITIAL_MEMORY"); - -assert(INITIAL_MEMORY >= TOTAL_STACK, "INITIAL_MEMORY should be larger than TOTAL_STACK, was " + INITIAL_MEMORY + "! (TOTAL_STACK=" + TOTAL_STACK + ")"); - -assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support"); - -assert(!Module["wasmMemory"], "Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"); - -assert(INITIAL_MEMORY == 33554432, "Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"); - -var wasmTable; - -function writeStackCookie() { - var max = _emscripten_stack_get_end(); - assert((max & 3) == 0); - HEAP32[max >> 2] = 34821223; - HEAP32[max + 4 >> 2] = 2310721022; - HEAPU32[0] = 1668509029; -} - -function checkStackCookie() { - if (ABORT) return; - var max = _emscripten_stack_get_end(); - var cookie1 = HEAPU32[max >> 2]; - var cookie2 = HEAPU32[max + 4 >> 2]; - if (cookie1 != 34821223 || cookie2 != 2310721022) { - abort("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x" + cookie2.toString(16) + " 0x" + cookie1.toString(16)); - } - if (HEAPU32[0] !== 1668509029) abort("Runtime error: The application has corrupted its heap memory area (address zero)!"); -} - -(function() { - var h16 = new Int16Array(1); - var h8 = new Int8Array(h16.buffer); - h16[0] = 25459; - if (h8[0] !== 115 || h8[1] !== 99) throw "Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"; -})(); - -var __ATPRERUN__ = []; - -var __ATINIT__ = []; - -var __ATPOSTRUN__ = []; - -var runtimeInitialized = false; - -function keepRuntimeAlive() { - return noExitRuntime; -} - -function preRun() { - if (Module["preRun"]) { - if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ]; - while (Module["preRun"].length) { - addOnPreRun(Module["preRun"].shift()); - } - } - callRuntimeCallbacks(__ATPRERUN__); -} - -function initRuntime() { - checkStackCookie(); - assert(!runtimeInitialized); - runtimeInitialized = true; - callRuntimeCallbacks(__ATINIT__); -} - -function postRun() { - checkStackCookie(); - if (Module["postRun"]) { - if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ]; - while (Module["postRun"].length) { - addOnPostRun(Module["postRun"].shift()); - } - } - callRuntimeCallbacks(__ATPOSTRUN__); -} - -function addOnPreRun(cb) { - __ATPRERUN__.unshift(cb); -} - -function addOnInit(cb) { - __ATINIT__.unshift(cb); -} - -function addOnPostRun(cb) { - __ATPOSTRUN__.unshift(cb); -} - -assert(Math.imul, "This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); - -assert(Math.fround, "This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); - -assert(Math.clz32, "This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); - -assert(Math.trunc, "This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"); - -var runDependencies = 0; - -var runDependencyWatcher = null; - -var dependenciesFulfilled = null; - -var runDependencyTracking = {}; - -function addRunDependency(id) { - runDependencies++; - if (Module["monitorRunDependencies"]) { - Module["monitorRunDependencies"](runDependencies); - } - if (id) { - assert(!runDependencyTracking[id]); - runDependencyTracking[id] = 1; - if (runDependencyWatcher === null && typeof setInterval != "undefined") { - runDependencyWatcher = setInterval(function() { - if (ABORT) { - clearInterval(runDependencyWatcher); - runDependencyWatcher = null; - return; - } - var shown = false; - for (var dep in runDependencyTracking) { - if (!shown) { - shown = true; - err("still waiting on run dependencies:"); - } - err("dependency: " + dep); - } - if (shown) { - err("(end of list)"); - } - }, 1e4); - } - } else { - err("warning: run dependency added without ID"); - } -} - -function removeRunDependency(id) { - runDependencies--; - if (Module["monitorRunDependencies"]) { - Module["monitorRunDependencies"](runDependencies); - } - if (id) { - assert(runDependencyTracking[id]); - delete runDependencyTracking[id]; - } else { - err("warning: run dependency removed without ID"); - } - if (runDependencies == 0) { - if (runDependencyWatcher !== null) { - clearInterval(runDependencyWatcher); - runDependencyWatcher = null; - } - if (dependenciesFulfilled) { - var callback = dependenciesFulfilled; - dependenciesFulfilled = null; - callback(); - } - } -} - -function abort(what) { - { - if (Module["onAbort"]) { - Module["onAbort"](what); - } - } - what = "Aborted(" + what + ")"; - err(what); - ABORT = true; - EXITSTATUS = 1; - var e = new WebAssembly.RuntimeError(what); - readyPromiseReject(e); - throw e; -} - -var FS = { - error: function() { - abort("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM"); - }, - init: function() { - FS.error(); - }, - createDataFile: function() { - FS.error(); - }, - createPreloadedFile: function() { - FS.error(); - }, - createLazyFile: function() { - FS.error(); - }, - open: function() { - FS.error(); - }, - mkdev: function() { - FS.error(); - }, - registerDevice: function() { - FS.error(); - }, - analyzePath: function() { - FS.error(); - }, - loadFilesFromDB: function() { - FS.error(); - }, - ErrnoError: function ErrnoError() { - FS.error(); - } -}; - -Module["FS_createDataFile"] = FS.createDataFile; - -Module["FS_createPreloadedFile"] = FS.createPreloadedFile; - -var dataURIPrefix = "data:application/octet-stream;base64,"; - -function isDataURI(filename) { - return filename.startsWith(dataURIPrefix); -} - -function isFileURI(filename) { - return filename.startsWith("file://"); -} - -function createExportWrapper(name, fixedasm) { - return function() { - var displayName = name; - var asm = fixedasm; - if (!fixedasm) { - asm = Module["asm"]; - } - assert(runtimeInitialized, "native function `" + displayName + "` called before runtime initialization"); - if (!asm[name]) { - assert(asm[name], "exported native function `" + displayName + "` not found"); - } - return asm[name].apply(null, arguments); - }; -} - -var wasmBinaryFile; - -wasmBinaryFile = "trace_converter_builtin.wasm"; - -if (!isDataURI(wasmBinaryFile)) { - wasmBinaryFile = locateFile(wasmBinaryFile); -} - -function getBinary(file) { - try { - if (file == wasmBinaryFile && wasmBinary) { - return new Uint8Array(wasmBinary); - } - if (readBinary) { - return readBinary(file); - } else { - throw "sync fetching of the wasm failed: you can preload it to Module['wasmBinary'] manually, or emcc.py will do that for you when generating HTML (but not JS)"; - } - } catch (err) { - abort(err); - } -} - -function instantiateSync(file, info) { - var instance; - var module; - var binary; - try { - binary = getBinary(file); - module = new WebAssembly.Module(binary); - instance = new WebAssembly.Instance(module, info); - } catch (e) { - var str = e.toString(); - err("failed to compile wasm module: " + str); - if (str.includes("imported Memory") || str.includes("memory import")) { - err("Memory size incompatibility issues may be due to changing INITIAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set INITIAL_MEMORY at runtime to something smaller than it was at compile time)."); - } - throw e; - } - return [ instance, module ]; -} - -function createWasm() { - var info = { - "env": asmLibraryArg, - "wasi_snapshot_preview1": asmLibraryArg - }; - function receiveInstance(instance, module) { - var exports = instance.exports; - Module["asm"] = exports; - wasmMemory = Module["asm"]["memory"]; - assert(wasmMemory, "memory not found in wasm exports"); - updateGlobalBufferAndViews(wasmMemory.buffer); - wasmTable = Module["asm"]["__indirect_function_table"]; - assert(wasmTable, "table not found in wasm exports"); - addOnInit(Module["asm"]["__wasm_call_ctors"]); - removeRunDependency("wasm-instantiate"); - } - addRunDependency("wasm-instantiate"); - if (Module["instantiateWasm"]) { - try { - var exports = Module["instantiateWasm"](info, receiveInstance); - return exports; - } catch (e) { - err("Module.instantiateWasm callback failed with error: " + e); - return false; - } - } - var result = instantiateSync(wasmBinaryFile, info); - receiveInstance(result[0]); - return Module["asm"]; -} - -var tempDouble; - -var tempI64; - -function callRuntimeCallbacks(callbacks) { - while (callbacks.length > 0) { - var callback = callbacks.shift(); - if (typeof callback == "function") { - callback(Module); - continue; - } - var func = callback.func; - if (typeof func == "number") { - if (callback.arg === undefined) { - getWasmTableEntry(func)(); - } else { - getWasmTableEntry(func)(callback.arg); - } - } else { - func(callback.arg === undefined ? null : callback.arg); - } - } -} - -function demangle(func) { - warnOnce("warning: build with -sDEMANGLE_SUPPORT to link in libcxxabi demangling"); - return func; -} - -function demangleAll(text) { - var regex = /\b_Z[\w\d_]+/g; - return text.replace(regex, function(x) { - var y = demangle(x); - return x === y ? x : y + " [" + x + "]"; - }); -} - -var wasmTableMirror = []; - -function getWasmTableEntry(funcPtr) { - var func = wasmTableMirror[funcPtr]; - if (!func) { - if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1; - wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr); - } - assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!"); - return func; -} - -function jsStackTrace() { - var error = new Error(); - if (!error.stack) { - try { - throw new Error(); - } catch (e) { - error = e; - } - if (!error.stack) { - return "(no stack trace available)"; - } - } - return error.stack.toString(); -} - -function setWasmTableEntry(idx, func) { - wasmTable.set(idx, func); - wasmTableMirror[idx] = wasmTable.get(idx); -} - -function ___assert_fail(condition, filename, line, func) { - abort("Assertion failed: " + UTF8ToString(condition) + ", at: " + [ filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function" ]); -} - -function ___cxa_allocate_exception(size) { - return _malloc(size + 24) + 24; -} - -function ExceptionInfo(excPtr) { - this.excPtr = excPtr; - this.ptr = excPtr - 24; - this.set_type = function(type) { - HEAPU32[this.ptr + 4 >> 2] = type; - }; - this.get_type = function() { - return HEAPU32[this.ptr + 4 >> 2]; - }; - this.set_destructor = function(destructor) { - HEAPU32[this.ptr + 8 >> 2] = destructor; - }; - this.get_destructor = function() { - return HEAPU32[this.ptr + 8 >> 2]; - }; - this.set_refcount = function(refcount) { - HEAP32[this.ptr >> 2] = refcount; - }; - this.set_caught = function(caught) { - caught = caught ? 1 : 0; - HEAP8[this.ptr + 12 >> 0] = caught; - }; - this.get_caught = function() { - return HEAP8[this.ptr + 12 >> 0] != 0; - }; - this.set_rethrown = function(rethrown) { - rethrown = rethrown ? 1 : 0; - HEAP8[this.ptr + 13 >> 0] = rethrown; - }; - this.get_rethrown = function() { - return HEAP8[this.ptr + 13 >> 0] != 0; - }; - this.init = function(type, destructor) { - this.set_adjusted_ptr(0); - this.set_type(type); - this.set_destructor(destructor); - this.set_refcount(0); - this.set_caught(false); - this.set_rethrown(false); - }; - this.add_ref = function() { - var value = HEAP32[this.ptr >> 2]; - HEAP32[this.ptr >> 2] = value + 1; - }; - this.release_ref = function() { - var prev = HEAP32[this.ptr >> 2]; - HEAP32[this.ptr >> 2] = prev - 1; - assert(prev > 0); - return prev === 1; - }; - this.set_adjusted_ptr = function(adjustedPtr) { - HEAPU32[this.ptr + 16 >> 2] = adjustedPtr; - }; - this.get_adjusted_ptr = function() { - return HEAPU32[this.ptr + 16 >> 2]; - }; - this.get_exception_ptr = function() { - var isPointer = ___cxa_is_pointer_type(this.get_type()); - if (isPointer) { - return HEAPU32[this.excPtr >> 2]; - } - var adjusted = this.get_adjusted_ptr(); - if (adjusted !== 0) return adjusted; - return this.excPtr; - }; -} - -var exceptionLast = 0; - -var uncaughtExceptionCount = 0; - -function ___cxa_throw(ptr, type, destructor) { - var info = new ExceptionInfo(ptr); - info.init(type, destructor); - exceptionLast = ptr; - uncaughtExceptionCount++; - throw ptr + " - Exception catching is disabled, this exception cannot be caught. Compile with -sNO_DISABLE_EXCEPTION_CATCHING or -sEXCEPTION_CATCHING_ALLOWED=[..] to catch."; -} - -function __emscripten_date_now() { - return Date.now(); -} - -var nowIsMonotonic = true; - -function __emscripten_get_now_is_monotonic() { - return nowIsMonotonic; -} - -function __localtime_js(time, tmPtr) { - var date = new Date(HEAP32[time >> 2] * 1e3); - HEAP32[tmPtr >> 2] = date.getSeconds(); - HEAP32[tmPtr + 4 >> 2] = date.getMinutes(); - HEAP32[tmPtr + 8 >> 2] = date.getHours(); - HEAP32[tmPtr + 12 >> 2] = date.getDate(); - HEAP32[tmPtr + 16 >> 2] = date.getMonth(); - HEAP32[tmPtr + 20 >> 2] = date.getFullYear() - 1900; - HEAP32[tmPtr + 24 >> 2] = date.getDay(); - var start = new Date(date.getFullYear(), 0, 1); - var yday = (date.getTime() - start.getTime()) / (1e3 * 60 * 60 * 24) | 0; - HEAP32[tmPtr + 28 >> 2] = yday; - HEAP32[tmPtr + 36 >> 2] = -(date.getTimezoneOffset() * 60); - var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset(); - var winterOffset = start.getTimezoneOffset(); - var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0; - HEAP32[tmPtr + 32 >> 2] = dst; -} - -function _tzset_impl(timezone, daylight, tzname) { - var currentYear = new Date().getFullYear(); - var winter = new Date(currentYear, 0, 1); - var summer = new Date(currentYear, 6, 1); - var winterOffset = winter.getTimezoneOffset(); - var summerOffset = summer.getTimezoneOffset(); - var stdTimezoneOffset = Math.max(winterOffset, summerOffset); - HEAP32[timezone >> 2] = stdTimezoneOffset * 60; - HEAP32[daylight >> 2] = Number(winterOffset != summerOffset); - function extractZone(date) { - var match = date.toTimeString().match(/\(([A-Za-z ]+)\)$/); - return match ? match[1] : "GMT"; - } - var winterName = extractZone(winter); - var summerName = extractZone(summer); - var winterNamePtr = allocateUTF8(winterName); - var summerNamePtr = allocateUTF8(summerName); - if (summerOffset < winterOffset) { - HEAPU32[tzname >> 2] = winterNamePtr; - HEAPU32[tzname + 4 >> 2] = summerNamePtr; - } else { - HEAPU32[tzname >> 2] = summerNamePtr; - HEAPU32[tzname + 4 >> 2] = winterNamePtr; - } -} - -function __tzset_js(timezone, daylight, tzname) { - if (__tzset_js.called) return; - __tzset_js.called = true; - _tzset_impl(timezone, daylight, tzname); -} - -function _abort() { - abort("native code called abort()"); -} - -var _emscripten_get_now; - -if (ENVIRONMENT_IS_NODE) { - _emscripten_get_now = () => { - var t = process["hrtime"](); - return t[0] * 1e3 + t[1] / 1e6; - }; -} else _emscripten_get_now = () => performance.now(); - -function _emscripten_memcpy_big(dest, src, num) { - HEAPU8.copyWithin(dest, src, src + num); -} - -function getHeapMax() { - return 2147483648; -} - -function emscripten_realloc_buffer(size) { - try { - wasmMemory.grow(size - buffer.byteLength + 65535 >>> 16); - updateGlobalBufferAndViews(wasmMemory.buffer); - return 1; - } catch (e) { - err("emscripten_realloc_buffer: Attempted to grow heap from " + buffer.byteLength + " bytes to " + size + " bytes, but got error: " + e); - } -} - -function _emscripten_resize_heap(requestedSize) { - var oldSize = HEAPU8.length; - requestedSize = requestedSize >>> 0; - assert(requestedSize > oldSize); - var maxHeapSize = getHeapMax(); - if (requestedSize > maxHeapSize) { - err("Cannot enlarge memory, asked to go up to " + requestedSize + " bytes, but the limit is " + maxHeapSize + " bytes!"); - return false; - } - let alignUp = (x, multiple) => x + (multiple - x % multiple) % multiple; - for (var cutDown = 1; cutDown <= 4; cutDown *= 2) { - var overGrownHeapSize = oldSize * (1 + .2 / cutDown); - overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296); - var newSize = Math.min(maxHeapSize, alignUp(Math.max(requestedSize, overGrownHeapSize), 65536)); - var replacement = emscripten_realloc_buffer(newSize); - if (replacement) { - return true; - } - } - err("Failed to grow the heap from " + oldSize + " bytes to " + newSize + " bytes, not enough memory!"); - return false; -} - -var ENV = {}; - -function getExecutableName() { - return thisProgram || "./this.program"; -} - -function getEnvStrings() { - if (!getEnvStrings.strings) { - var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8"; - var env = { - "USER": "web_user", - "LOGNAME": "web_user", - "PATH": "/", - "PWD": "/", - "HOME": "/home/web_user", - "LANG": lang, - "_": getExecutableName() - }; - for (var x in ENV) { - if (ENV[x] === undefined) delete env[x]; else env[x] = ENV[x]; - } - var strings = []; - for (var x in env) { - strings.push(x + "=" + env[x]); - } - getEnvStrings.strings = strings; - } - return getEnvStrings.strings; -} - -var SYSCALLS = { - varargs: undefined, - get: function() { - assert(SYSCALLS.varargs != undefined); - SYSCALLS.varargs += 4; - var ret = HEAP32[SYSCALLS.varargs - 4 >> 2]; - return ret; - }, - getStr: function(ptr) { - var ret = UTF8ToString(ptr); - return ret; - } -}; - -function _environ_get(__environ, environ_buf) { - var bufSize = 0; - getEnvStrings().forEach(function(string, i) { - var ptr = environ_buf + bufSize; - HEAPU32[__environ + i * 4 >> 2] = ptr; - writeAsciiToMemory(string, ptr); - bufSize += string.length + 1; - }); - return 0; -} - -function _environ_sizes_get(penviron_count, penviron_buf_size) { - var strings = getEnvStrings(); - HEAPU32[penviron_count >> 2] = strings.length; - var bufSize = 0; - strings.forEach(function(string) { - bufSize += string.length + 1; - }); - HEAPU32[penviron_buf_size >> 2] = bufSize; - return 0; -} - -function _fd_close(fd) { - abort("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM"); -} - -function _fd_seek(fd, offset_low, offset_high, whence, newOffset) { - return 70; -} - -var printCharBuffers = [ null, [], [] ]; - -function printChar(stream, curr) { - var buffer = printCharBuffers[stream]; - assert(buffer); - if (curr === 0 || curr === 10) { - (stream === 1 ? out : err)(UTF8ArrayToString(buffer, 0)); - buffer.length = 0; - } else { - buffer.push(curr); - } -} - -function flush_NO_FILESYSTEM() { - _fflush(0); - if (printCharBuffers[1].length) printChar(1, 10); - if (printCharBuffers[2].length) printChar(2, 10); -} - -function _fd_write(fd, iov, iovcnt, pnum) { - var num = 0; - for (var i = 0; i < iovcnt; i++) { - var ptr = HEAPU32[iov >> 2]; - var len = HEAPU32[iov + 4 >> 2]; - iov += 8; - for (var j = 0; j < len; j++) { - printChar(fd, HEAPU8[ptr + j]); - } - num += len; - } - HEAPU32[pnum >> 2] = num; - return 0; -} - -function _setTempRet0(val) { - setTempRet0(val); -} - -function __isLeapYear(year) { - return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); -} - -function __arraySum(array, index) { - var sum = 0; - for (var i = 0; i <= index; sum += array[i++]) {} - return sum; -} - -var __MONTH_DAYS_LEAP = [ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]; - -var __MONTH_DAYS_REGULAR = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ]; - -function __addDays(date, days) { - var newDate = new Date(date.getTime()); - while (days > 0) { - var leap = __isLeapYear(newDate.getFullYear()); - var currentMonth = newDate.getMonth(); - var daysInCurrentMonth = (leap ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR)[currentMonth]; - if (days > daysInCurrentMonth - newDate.getDate()) { - days -= daysInCurrentMonth - newDate.getDate() + 1; - newDate.setDate(1); - if (currentMonth < 11) { - newDate.setMonth(currentMonth + 1); - } else { - newDate.setMonth(0); - newDate.setFullYear(newDate.getFullYear() + 1); - } - } else { - newDate.setDate(newDate.getDate() + days); - return newDate; - } - } - return newDate; -} - -function _strftime(s, maxsize, format, tm) { - var tm_zone = HEAP32[tm + 40 >> 2]; - var date = { - tm_sec: HEAP32[tm >> 2], - tm_min: HEAP32[tm + 4 >> 2], - tm_hour: HEAP32[tm + 8 >> 2], - tm_mday: HEAP32[tm + 12 >> 2], - tm_mon: HEAP32[tm + 16 >> 2], - tm_year: HEAP32[tm + 20 >> 2], - tm_wday: HEAP32[tm + 24 >> 2], - tm_yday: HEAP32[tm + 28 >> 2], - tm_isdst: HEAP32[tm + 32 >> 2], - tm_gmtoff: HEAP32[tm + 36 >> 2], - tm_zone: tm_zone ? UTF8ToString(tm_zone) : "" - }; - var pattern = UTF8ToString(format); - var EXPANSION_RULES_1 = { - "%c": "%a %b %d %H:%M:%S %Y", - "%D": "%m/%d/%y", - "%F": "%Y-%m-%d", - "%h": "%b", - "%r": "%I:%M:%S %p", - "%R": "%H:%M", - "%T": "%H:%M:%S", - "%x": "%m/%d/%y", - "%X": "%H:%M:%S", - "%Ec": "%c", - "%EC": "%C", - "%Ex": "%m/%d/%y", - "%EX": "%H:%M:%S", - "%Ey": "%y", - "%EY": "%Y", - "%Od": "%d", - "%Oe": "%e", - "%OH": "%H", - "%OI": "%I", - "%Om": "%m", - "%OM": "%M", - "%OS": "%S", - "%Ou": "%u", - "%OU": "%U", - "%OV": "%V", - "%Ow": "%w", - "%OW": "%W", - "%Oy": "%y" - }; - for (var rule in EXPANSION_RULES_1) { - pattern = pattern.replace(new RegExp(rule, "g"), EXPANSION_RULES_1[rule]); - } - var WEEKDAYS = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ]; - var MONTHS = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ]; - function leadingSomething(value, digits, character) { - var str = typeof value == "number" ? value.toString() : value || ""; - while (str.length < digits) { - str = character[0] + str; - } - return str; - } - function leadingNulls(value, digits) { - return leadingSomething(value, digits, "0"); - } - function compareByDay(date1, date2) { - function sgn(value) { - return value < 0 ? -1 : value > 0 ? 1 : 0; - } - var compare; - if ((compare = sgn(date1.getFullYear() - date2.getFullYear())) === 0) { - if ((compare = sgn(date1.getMonth() - date2.getMonth())) === 0) { - compare = sgn(date1.getDate() - date2.getDate()); - } - } - return compare; - } - function getFirstWeekStartDate(janFourth) { - switch (janFourth.getDay()) { - case 0: - return new Date(janFourth.getFullYear() - 1, 11, 29); - - case 1: - return janFourth; - - case 2: - return new Date(janFourth.getFullYear(), 0, 3); - - case 3: - return new Date(janFourth.getFullYear(), 0, 2); - - case 4: - return new Date(janFourth.getFullYear(), 0, 1); - - case 5: - return new Date(janFourth.getFullYear() - 1, 11, 31); - - case 6: - return new Date(janFourth.getFullYear() - 1, 11, 30); - } - } - function getWeekBasedYear(date) { - var thisDate = __addDays(new Date(date.tm_year + 1900, 0, 1), date.tm_yday); - var janFourthThisYear = new Date(thisDate.getFullYear(), 0, 4); - var janFourthNextYear = new Date(thisDate.getFullYear() + 1, 0, 4); - var firstWeekStartThisYear = getFirstWeekStartDate(janFourthThisYear); - var firstWeekStartNextYear = getFirstWeekStartDate(janFourthNextYear); - if (compareByDay(firstWeekStartThisYear, thisDate) <= 0) { - if (compareByDay(firstWeekStartNextYear, thisDate) <= 0) { - return thisDate.getFullYear() + 1; - } else { - return thisDate.getFullYear(); - } - } else { - return thisDate.getFullYear() - 1; - } - } - var EXPANSION_RULES_2 = { - "%a": function(date) { - return WEEKDAYS[date.tm_wday].substring(0, 3); - }, - "%A": function(date) { - return WEEKDAYS[date.tm_wday]; - }, - "%b": function(date) { - return MONTHS[date.tm_mon].substring(0, 3); - }, - "%B": function(date) { - return MONTHS[date.tm_mon]; - }, - "%C": function(date) { - var year = date.tm_year + 1900; - return leadingNulls(year / 100 | 0, 2); - }, - "%d": function(date) { - return leadingNulls(date.tm_mday, 2); - }, - "%e": function(date) { - return leadingSomething(date.tm_mday, 2, " "); - }, - "%g": function(date) { - return getWeekBasedYear(date).toString().substring(2); - }, - "%G": function(date) { - return getWeekBasedYear(date); - }, - "%H": function(date) { - return leadingNulls(date.tm_hour, 2); - }, - "%I": function(date) { - var twelveHour = date.tm_hour; - if (twelveHour == 0) twelveHour = 12; else if (twelveHour > 12) twelveHour -= 12; - return leadingNulls(twelveHour, 2); - }, - "%j": function(date) { - return leadingNulls(date.tm_mday + __arraySum(__isLeapYear(date.tm_year + 1900) ? __MONTH_DAYS_LEAP : __MONTH_DAYS_REGULAR, date.tm_mon - 1), 3); - }, - "%m": function(date) { - return leadingNulls(date.tm_mon + 1, 2); - }, - "%M": function(date) { - return leadingNulls(date.tm_min, 2); - }, - "%n": function() { - return "\n"; - }, - "%p": function(date) { - if (date.tm_hour >= 0 && date.tm_hour < 12) { - return "AM"; - } else { - return "PM"; - } - }, - "%S": function(date) { - return leadingNulls(date.tm_sec, 2); - }, - "%t": function() { - return "\t"; - }, - "%u": function(date) { - return date.tm_wday || 7; - }, - "%U": function(date) { - var days = date.tm_yday + 7 - date.tm_wday; - return leadingNulls(Math.floor(days / 7), 2); - }, - "%V": function(date) { - var val = Math.floor((date.tm_yday + 7 - (date.tm_wday + 6) % 7) / 7); - if ((date.tm_wday + 371 - date.tm_yday - 2) % 7 <= 2) { - val++; - } - if (!val) { - val = 52; - var dec31 = (date.tm_wday + 7 - date.tm_yday - 1) % 7; - if (dec31 == 4 || dec31 == 5 && __isLeapYear(date.tm_year % 400 - 1)) { - val++; - } - } else if (val == 53) { - var jan1 = (date.tm_wday + 371 - date.tm_yday) % 7; - if (jan1 != 4 && (jan1 != 3 || !__isLeapYear(date.tm_year))) val = 1; - } - return leadingNulls(val, 2); - }, - "%w": function(date) { - return date.tm_wday; - }, - "%W": function(date) { - var days = date.tm_yday + 7 - (date.tm_wday + 6) % 7; - return leadingNulls(Math.floor(days / 7), 2); - }, - "%y": function(date) { - return (date.tm_year + 1900).toString().substring(2); - }, - "%Y": function(date) { - return date.tm_year + 1900; - }, - "%z": function(date) { - var off = date.tm_gmtoff; - var ahead = off >= 0; - off = Math.abs(off) / 60; - off = off / 60 * 100 + off % 60; - return (ahead ? "+" : "-") + String("0000" + off).slice(-4); - }, - "%Z": function(date) { - return date.tm_zone; - }, - "%%": function() { - return "%"; - } - }; - pattern = pattern.replace(/%%/g, "\0\0"); - for (var rule in EXPANSION_RULES_2) { - if (pattern.includes(rule)) { - pattern = pattern.replace(new RegExp(rule, "g"), EXPANSION_RULES_2[rule](date)); - } - } - pattern = pattern.replace(/\0\0/g, "%"); - var bytes = intArrayFromString(pattern, false); - if (bytes.length > maxsize) { - return 0; - } - writeArrayToMemory(bytes, s); - return bytes.length - 1; -} - -function _strftime_l(s, maxsize, format, tm) { - return _strftime(s, maxsize, format, tm); -} - -var ASSERTIONS = true; - -function intArrayFromString(stringy, dontAddNull, length) { - var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1; - var u8array = new Array(len); - var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length); - if (dontAddNull) u8array.length = numBytesWritten; - return u8array; -} - -function checkIncomingModuleAPI() { - ignoredModuleProp("fetchSettings"); -} - -var asmLibraryArg = { - "__assert_fail": ___assert_fail, - "__cxa_allocate_exception": ___cxa_allocate_exception, - "__cxa_throw": ___cxa_throw, - "_emscripten_date_now": __emscripten_date_now, - "_emscripten_get_now_is_monotonic": __emscripten_get_now_is_monotonic, - "_localtime_js": __localtime_js, - "_tzset_js": __tzset_js, - "abort": _abort, - "emscripten_get_now": _emscripten_get_now, - "emscripten_memcpy_big": _emscripten_memcpy_big, - "emscripten_resize_heap": _emscripten_resize_heap, - "environ_get": _environ_get, - "environ_sizes_get": _environ_sizes_get, - "fd_close": _fd_close, - "fd_seek": _fd_seek, - "fd_write": _fd_write, - "setTempRet0": _setTempRet0, - "strftime": _strftime, - "strftime_l": _strftime_l -}; - -var asm = createWasm(); - -var ___wasm_call_ctors = Module["___wasm_call_ctors"] = createExportWrapper("__wasm_call_ctors", asm); - -var _GetFinalHeader = Module["_GetFinalHeader"] = createExportWrapper("GetFinalHeader", asm); - -var _GetTraceConverterIns = Module["_GetTraceConverterIns"] = createExportWrapper("GetTraceConverterIns", asm); - -var _ReleaseTraceConverterIns = Module["_ReleaseTraceConverterIns"] = createExportWrapper("ReleaseTraceConverterIns", asm); - -var _SetDebugFlag = Module["_SetDebugFlag"] = createExportWrapper("SetDebugFlag", asm); - -var _ConvertBlockData = Module["_ConvertBlockData"] = createExportWrapper("ConvertBlockData", asm); - -var _SendFileHeader = Module["_SendFileHeader"] = createExportWrapper("SendFileHeader", asm); - -var _SetCallback = Module["_SetCallback"] = createExportWrapper("SetCallback", asm); - -var _GetRemainingData = Module["_GetRemainingData"] = createExportWrapper("GetRemainingData", asm); - -var _SendRawFileHeader = Module["_SendRawFileHeader"] = createExportWrapper("SendRawFileHeader", asm); - -var _ConvertRawBlockData = Module["_ConvertRawBlockData"] = createExportWrapper("ConvertRawBlockData", asm); - -var _fflush = Module["_fflush"] = createExportWrapper("fflush", asm); - -var ___errno_location = Module["___errno_location"] = createExportWrapper("__errno_location", asm); - -var _malloc = Module["_malloc"] = createExportWrapper("malloc", asm); - -var _free = Module["_free"] = createExportWrapper("free", asm); - -var _emscripten_stack_init = Module["_emscripten_stack_init"] = asm["emscripten_stack_init"]; - -var _emscripten_stack_get_free = Module["_emscripten_stack_get_free"] = asm["emscripten_stack_get_free"]; - -var _emscripten_stack_get_base = Module["_emscripten_stack_get_base"] = asm["emscripten_stack_get_base"]; - -var _emscripten_stack_get_end = Module["_emscripten_stack_get_end"] = asm["emscripten_stack_get_end"]; - -var stackSave = Module["stackSave"] = createExportWrapper("stackSave", asm); - -var stackRestore = Module["stackRestore"] = createExportWrapper("stackRestore", asm); - -var stackAlloc = Module["stackAlloc"] = createExportWrapper("stackAlloc", asm); - -var ___cxa_is_pointer_type = Module["___cxa_is_pointer_type"] = createExportWrapper("__cxa_is_pointer_type", asm); - -var dynCall_jj = Module["dynCall_jj"] = createExportWrapper("dynCall_jj", asm); - -var dynCall_jii = Module["dynCall_jii"] = createExportWrapper("dynCall_jii", asm); - -var dynCall_viji = Module["dynCall_viji"] = createExportWrapper("dynCall_viji", asm); - -var dynCall_ji = Module["dynCall_ji"] = createExportWrapper("dynCall_ji", asm); - -var dynCall_jiji = Module["dynCall_jiji"] = createExportWrapper("dynCall_jiji", asm); - -var dynCall_viijii = Module["dynCall_viijii"] = createExportWrapper("dynCall_viijii", asm); - -var dynCall_iiiiij = Module["dynCall_iiiiij"] = createExportWrapper("dynCall_iiiiij", asm); - -var dynCall_iiiiijj = Module["dynCall_iiiiijj"] = createExportWrapper("dynCall_iiiiijj", asm); - -var dynCall_iiiiiijj = Module["dynCall_iiiiiijj"] = createExportWrapper("dynCall_iiiiiijj", asm); - -Module["ccall"] = ccall; - -unexportedRuntimeFunction("cwrap", false); - -unexportedRuntimeFunction("allocate", false); - -unexportedRuntimeFunction("UTF8ArrayToString", false); - -unexportedRuntimeFunction("UTF8ToString", false); - -unexportedRuntimeFunction("stringToUTF8Array", false); - -unexportedRuntimeFunction("stringToUTF8", false); - -unexportedRuntimeFunction("lengthBytesUTF8", false); - -unexportedRuntimeFunction("addOnPreRun", false); - -unexportedRuntimeFunction("addOnInit", false); - -unexportedRuntimeFunction("addOnPreMain", false); - -unexportedRuntimeFunction("addOnExit", false); - -unexportedRuntimeFunction("addOnPostRun", false); - -unexportedRuntimeFunction("addRunDependency", true); - -unexportedRuntimeFunction("removeRunDependency", true); - -unexportedRuntimeFunction("FS_createFolder", false); - -unexportedRuntimeFunction("FS_createPath", true); - -unexportedRuntimeFunction("FS_createDataFile", true); - -unexportedRuntimeFunction("FS_createPreloadedFile", true); - -unexportedRuntimeFunction("FS_createLazyFile", true); - -unexportedRuntimeFunction("FS_createLink", false); - -unexportedRuntimeFunction("FS_createDevice", true); - -unexportedRuntimeFunction("FS_unlink", true); - -unexportedRuntimeFunction("getLEB", false); - -unexportedRuntimeFunction("getFunctionTables", false); - -unexportedRuntimeFunction("alignFunctionTables", false); - -unexportedRuntimeFunction("registerFunctions", false); - -Module["addFunction"] = addFunction; - -unexportedRuntimeFunction("removeFunction", false); - -unexportedRuntimeFunction("prettyPrint", false); - -unexportedRuntimeFunction("getCompilerSetting", false); - -unexportedRuntimeFunction("print", false); - -unexportedRuntimeFunction("printErr", false); - -unexportedRuntimeFunction("getTempRet0", false); - -unexportedRuntimeFunction("setTempRet0", false); - -unexportedRuntimeFunction("callMain", false); - -unexportedRuntimeFunction("abort", false); - -unexportedRuntimeFunction("keepRuntimeAlive", false); - -unexportedRuntimeFunction("wasmMemory", false); - -unexportedRuntimeFunction("warnOnce", false); - -unexportedRuntimeFunction("stackSave", false); - -unexportedRuntimeFunction("stackRestore", false); - -unexportedRuntimeFunction("stackAlloc", false); - -unexportedRuntimeFunction("AsciiToString", false); - -unexportedRuntimeFunction("stringToAscii", false); - -unexportedRuntimeFunction("UTF16ToString", false); - -unexportedRuntimeFunction("stringToUTF16", false); - -unexportedRuntimeFunction("lengthBytesUTF16", false); - -unexportedRuntimeFunction("UTF32ToString", false); - -unexportedRuntimeFunction("stringToUTF32", false); - -unexportedRuntimeFunction("lengthBytesUTF32", false); - -unexportedRuntimeFunction("allocateUTF8", false); - -unexportedRuntimeFunction("allocateUTF8OnStack", false); - -unexportedRuntimeFunction("ExitStatus", false); - -unexportedRuntimeFunction("intArrayFromString", false); - -unexportedRuntimeFunction("intArrayToString", false); - -unexportedRuntimeFunction("writeStringToMemory", false); - -unexportedRuntimeFunction("writeArrayToMemory", false); - -unexportedRuntimeFunction("writeAsciiToMemory", false); - -Module["writeStackCookie"] = writeStackCookie; - -Module["checkStackCookie"] = checkStackCookie; - -unexportedRuntimeFunction("ptrToString", false); - -unexportedRuntimeFunction("zeroMemory", false); - -unexportedRuntimeFunction("stringToNewUTF8", false); - -unexportedRuntimeFunction("getHeapMax", false); - -unexportedRuntimeFunction("emscripten_realloc_buffer", false); - -unexportedRuntimeFunction("ENV", false); - -unexportedRuntimeFunction("ERRNO_CODES", false); - -unexportedRuntimeFunction("ERRNO_MESSAGES", false); - -unexportedRuntimeFunction("setErrNo", false); - -unexportedRuntimeFunction("inetPton4", false); - -unexportedRuntimeFunction("inetNtop4", false); - -unexportedRuntimeFunction("inetPton6", false); - -unexportedRuntimeFunction("inetNtop6", false); - -unexportedRuntimeFunction("readSockaddr", false); - -unexportedRuntimeFunction("writeSockaddr", false); - -unexportedRuntimeFunction("DNS", false); - -unexportedRuntimeFunction("getHostByName", false); - -unexportedRuntimeFunction("Protocols", false); - -unexportedRuntimeFunction("Sockets", false); - -unexportedRuntimeFunction("getRandomDevice", false); - -unexportedRuntimeFunction("traverseStack", false); - -unexportedRuntimeFunction("UNWIND_CACHE", false); - -unexportedRuntimeFunction("convertPCtoSourceLocation", false); - -unexportedRuntimeFunction("readAsmConstArgsArray", false); - -unexportedRuntimeFunction("readAsmConstArgs", false); - -unexportedRuntimeFunction("mainThreadEM_ASM", false); - -unexportedRuntimeFunction("jstoi_q", false); - -unexportedRuntimeFunction("jstoi_s", false); - -unexportedRuntimeFunction("getExecutableName", false); - -unexportedRuntimeFunction("listenOnce", false); - -unexportedRuntimeFunction("autoResumeAudioContext", false); - -unexportedRuntimeFunction("dynCallLegacy", false); - -unexportedRuntimeFunction("getDynCaller", false); - -unexportedRuntimeFunction("dynCall", false); - -unexportedRuntimeFunction("handleException", false); - -unexportedRuntimeFunction("runtimeKeepalivePush", false); - -unexportedRuntimeFunction("runtimeKeepalivePop", false); - -unexportedRuntimeFunction("callUserCallback", false); - -unexportedRuntimeFunction("maybeExit", false); - -unexportedRuntimeFunction("safeSetTimeout", false); - -unexportedRuntimeFunction("asmjsMangle", false); - -unexportedRuntimeFunction("asyncLoad", false); - -unexportedRuntimeFunction("alignMemory", false); - -unexportedRuntimeFunction("mmapAlloc", false); - -unexportedRuntimeFunction("writeI53ToI64", false); - -unexportedRuntimeFunction("writeI53ToI64Clamped", false); - -unexportedRuntimeFunction("writeI53ToI64Signaling", false); - -unexportedRuntimeFunction("writeI53ToU64Clamped", false); - -unexportedRuntimeFunction("writeI53ToU64Signaling", false); - -unexportedRuntimeFunction("readI53FromI64", false); - -unexportedRuntimeFunction("readI53FromU64", false); - -unexportedRuntimeFunction("convertI32PairToI53", false); - -unexportedRuntimeFunction("convertI32PairToI53Checked", false); - -unexportedRuntimeFunction("convertU32PairToI53", false); - -unexportedRuntimeFunction("reallyNegative", false); - -unexportedRuntimeFunction("unSign", false); - -unexportedRuntimeFunction("strLen", false); - -unexportedRuntimeFunction("reSign", false); - -unexportedRuntimeFunction("formatString", false); - -unexportedRuntimeFunction("setValue", false); - -unexportedRuntimeFunction("getValue", false); - -unexportedRuntimeFunction("PATH", false); - -unexportedRuntimeFunction("PATH_FS", false); - -unexportedRuntimeFunction("SYSCALLS", false); - -unexportedRuntimeFunction("getSocketFromFD", false); - -unexportedRuntimeFunction("getSocketAddress", false); - -unexportedRuntimeFunction("JSEvents", false); - -unexportedRuntimeFunction("registerKeyEventCallback", false); - -unexportedRuntimeFunction("specialHTMLTargets", false); - -unexportedRuntimeFunction("maybeCStringToJsString", false); - -unexportedRuntimeFunction("findEventTarget", false); - -unexportedRuntimeFunction("findCanvasEventTarget", false); - -unexportedRuntimeFunction("getBoundingClientRect", false); - -unexportedRuntimeFunction("fillMouseEventData", false); - -unexportedRuntimeFunction("registerMouseEventCallback", false); - -unexportedRuntimeFunction("registerWheelEventCallback", false); - -unexportedRuntimeFunction("registerUiEventCallback", false); - -unexportedRuntimeFunction("registerFocusEventCallback", false); - -unexportedRuntimeFunction("fillDeviceOrientationEventData", false); - -unexportedRuntimeFunction("registerDeviceOrientationEventCallback", false); - -unexportedRuntimeFunction("fillDeviceMotionEventData", false); - -unexportedRuntimeFunction("registerDeviceMotionEventCallback", false); - -unexportedRuntimeFunction("screenOrientation", false); - -unexportedRuntimeFunction("fillOrientationChangeEventData", false); - -unexportedRuntimeFunction("registerOrientationChangeEventCallback", false); - -unexportedRuntimeFunction("fillFullscreenChangeEventData", false); - -unexportedRuntimeFunction("registerFullscreenChangeEventCallback", false); - -unexportedRuntimeFunction("JSEvents_requestFullscreen", false); - -unexportedRuntimeFunction("JSEvents_resizeCanvasForFullscreen", false); - -unexportedRuntimeFunction("registerRestoreOldStyle", false); - -unexportedRuntimeFunction("hideEverythingExceptGivenElement", false); - -unexportedRuntimeFunction("restoreHiddenElements", false); - -unexportedRuntimeFunction("setLetterbox", false); - -unexportedRuntimeFunction("currentFullscreenStrategy", false); - -unexportedRuntimeFunction("restoreOldWindowedStyle", false); - -unexportedRuntimeFunction("softFullscreenResizeWebGLRenderTarget", false); - -unexportedRuntimeFunction("doRequestFullscreen", false); - -unexportedRuntimeFunction("fillPointerlockChangeEventData", false); - -unexportedRuntimeFunction("registerPointerlockChangeEventCallback", false); - -unexportedRuntimeFunction("registerPointerlockErrorEventCallback", false); - -unexportedRuntimeFunction("requestPointerLock", false); - -unexportedRuntimeFunction("fillVisibilityChangeEventData", false); - -unexportedRuntimeFunction("registerVisibilityChangeEventCallback", false); - -unexportedRuntimeFunction("registerTouchEventCallback", false); - -unexportedRuntimeFunction("fillGamepadEventData", false); - -unexportedRuntimeFunction("registerGamepadEventCallback", false); - -unexportedRuntimeFunction("registerBeforeUnloadEventCallback", false); - -unexportedRuntimeFunction("fillBatteryEventData", false); - -unexportedRuntimeFunction("battery", false); - -unexportedRuntimeFunction("registerBatteryEventCallback", false); - -unexportedRuntimeFunction("setCanvasElementSize", false); - -unexportedRuntimeFunction("getCanvasElementSize", false); - -unexportedRuntimeFunction("demangle", false); - -unexportedRuntimeFunction("demangleAll", false); - -unexportedRuntimeFunction("jsStackTrace", false); - -unexportedRuntimeFunction("stackTrace", false); - -unexportedRuntimeFunction("getEnvStrings", false); - -unexportedRuntimeFunction("checkWasiClock", false); - -unexportedRuntimeFunction("flush_NO_FILESYSTEM", false); - -unexportedRuntimeFunction("dlopenMissingError", false); - -unexportedRuntimeFunction("setImmediateWrapped", false); - -unexportedRuntimeFunction("clearImmediateWrapped", false); - -unexportedRuntimeFunction("polyfillSetImmediate", false); - -unexportedRuntimeFunction("uncaughtExceptionCount", false); - -unexportedRuntimeFunction("exceptionLast", false); - -unexportedRuntimeFunction("exceptionCaught", false); - -unexportedRuntimeFunction("ExceptionInfo", false); - -unexportedRuntimeFunction("exception_addRef", false); - -unexportedRuntimeFunction("exception_decRef", false); - -unexportedRuntimeFunction("Browser", false); - -unexportedRuntimeFunction("setMainLoop", false); - -unexportedRuntimeFunction("wget", false); - -Module["FS"] = FS; - -unexportedRuntimeFunction("MEMFS", false); - -unexportedRuntimeFunction("TTY", false); - -unexportedRuntimeFunction("PIPEFS", false); - -unexportedRuntimeFunction("SOCKFS", false); - -unexportedRuntimeFunction("_setNetworkCallback", false); - -unexportedRuntimeFunction("tempFixedLengthArray", false); - -unexportedRuntimeFunction("miniTempWebGLFloatBuffers", false); - -unexportedRuntimeFunction("heapObjectForWebGLType", false); - -unexportedRuntimeFunction("heapAccessShiftForWebGLHeap", false); - -unexportedRuntimeFunction("GL", false); - -unexportedRuntimeFunction("emscriptenWebGLGet", false); - -unexportedRuntimeFunction("computeUnpackAlignedImageSize", false); - -unexportedRuntimeFunction("emscriptenWebGLGetTexPixelData", false); - -unexportedRuntimeFunction("emscriptenWebGLGetUniform", false); - -unexportedRuntimeFunction("webglGetUniformLocation", false); - -unexportedRuntimeFunction("webglPrepareUniformLocationsBeforeFirstUse", false); - -unexportedRuntimeFunction("webglGetLeftBracePos", false); - -unexportedRuntimeFunction("emscriptenWebGLGetVertexAttrib", false); - -unexportedRuntimeFunction("writeGLArray", false); - -unexportedRuntimeFunction("AL", false); - -unexportedRuntimeFunction("SDL_unicode", false); - -unexportedRuntimeFunction("SDL_ttfContext", false); - -unexportedRuntimeFunction("SDL_audio", false); - -unexportedRuntimeFunction("SDL", false); - -unexportedRuntimeFunction("SDL_gfx", false); - -unexportedRuntimeFunction("GLUT", false); - -unexportedRuntimeFunction("EGL", false); - -unexportedRuntimeFunction("GLFW_Window", false); - -unexportedRuntimeFunction("GLFW", false); - -unexportedRuntimeFunction("GLEW", false); - -unexportedRuntimeFunction("IDBStore", false); - -unexportedRuntimeFunction("runAndAbortIfError", false); - -unexportedRuntimeSymbol("ALLOC_NORMAL", false); - -unexportedRuntimeSymbol("ALLOC_STACK", false); - -var calledRun; - -function ExitStatus(status) { - this.name = "ExitStatus"; - this.message = "Program terminated with exit(" + status + ")"; - this.status = status; -} - -dependenciesFulfilled = function runCaller() { - if (!calledRun) run(); - if (!calledRun) dependenciesFulfilled = runCaller; -}; - -function stackCheckInit() { - _emscripten_stack_init(); - writeStackCookie(); -} - -function run(args) { - args = args || arguments_; - if (runDependencies > 0) { - return; - } - stackCheckInit(); - preRun(); - if (runDependencies > 0) { - return; - } - function doRun() { - if (calledRun) return; - calledRun = true; - Module["calledRun"] = true; - if (ABORT) return; - initRuntime(); - readyPromiseResolve(Module); - if (Module["onRuntimeInitialized"]) Module["onRuntimeInitialized"](); - assert(!Module["_main"], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'); - postRun(); - } - if (Module["setStatus"]) { - Module["setStatus"]("Running..."); - setTimeout(function() { - setTimeout(function() { - Module["setStatus"](""); - }, 1); - doRun(); - }, 1); - } else { - doRun(); - } - checkStackCookie(); -} - -Module["run"] = run; - -function checkUnflushedContent() { - var oldOut = out; - var oldErr = err; - var has = false; - out = err = x => { - has = true; - }; - try { - flush_NO_FILESYSTEM(); - } catch (e) {} - out = oldOut; - err = oldErr; - if (has) { - warnOnce("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the FAQ), or make sure to emit a newline when you printf etc."); - warnOnce("(this may also be due to not including full filesystem support - try building with -sFORCE_FILESYSTEM)"); - } -} - -function procExit(code) { - EXITSTATUS = code; - if (!keepRuntimeAlive()) { - if (Module["onExit"]) Module["onExit"](code); - ABORT = true; - } - quit_(code, new ExitStatus(code)); -} - -if (Module["preInit"]) { - if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ]; - while (Module["preInit"].length > 0) { - Module["preInit"].pop()(); - } -} - -run(); - - - return trace_converter_builtin_wasm -} -); -})(); -if (typeof exports === 'object' && typeof module === 'object') - module.exports = trace_converter_builtin_wasm; -else if (typeof define === 'function' && define['amd']) - define([], function() { return trace_converter_builtin_wasm; }); -else if (typeof exports === 'object') - exports["trace_converter_builtin_wasm"] = trace_converter_builtin_wasm; -- Gitee