js:锄地一条龙1.3.5和新js"性能测试" (#1497)
This commit is contained in:
29
repo/js/ComputerBlower/main.js
Normal file
29
repo/js/ComputerBlower/main.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// 主函数
|
||||
(async function () {
|
||||
let startTime = Date.now();
|
||||
const interval = +settings.interval || 1000;
|
||||
const timeout = +settings.timeout || 60;
|
||||
let lastCheck = startTime;
|
||||
let ocrcount = 0;
|
||||
let loopCount = 0;
|
||||
let logCount = 0;
|
||||
//let store = [];
|
||||
while (Date.now() - startTime < timeout * 1000) {
|
||||
loopCount++;
|
||||
try {
|
||||
let GameRegion = captureGameRegion();
|
||||
// store[loopCount] = GameRegion;
|
||||
if (settings.dispose) GameRegion.dispose();
|
||||
ocrcount++;
|
||||
} catch (error) {
|
||||
log.error(`运行时发生异常: ${error.message}`);
|
||||
break;
|
||||
}
|
||||
if (Date.now() - lastCheck >= interval) {
|
||||
logCount++;
|
||||
lastCheck = Date.now();
|
||||
log.info(`在第${logCount}个${interval}毫秒内执行了${ocrcount}次截图`);
|
||||
ocrcount = 0;
|
||||
}
|
||||
}
|
||||
})();
|
||||
16
repo/js/ComputerBlower/manifest.json
Normal file
16
repo/js/ComputerBlower/manifest.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"manifest_version": 1,
|
||||
"name": "截图性能测试",
|
||||
"version": "0.1",
|
||||
"tags": [],
|
||||
"bgi_version": "0.46.0",
|
||||
"description": "测测你的",
|
||||
"authors": [
|
||||
{
|
||||
"name": "mno",
|
||||
}
|
||||
],
|
||||
"settings_ui": "settings.json",
|
||||
"main": "main.js"
|
||||
}
|
||||
|
||||
2
repo/js/ComputerBlower/readme.md
Normal file
2
repo/js/ComputerBlower/readme.md
Normal file
@@ -0,0 +1,2 @@
|
||||
运行后将会尝试满负荷循环截图,并在日志输出截图次数,可在自定义配置选择是否dispose
|
||||
|
||||
19
repo/js/ComputerBlower/settings.json
Normal file
19
repo/js/ComputerBlower/settings.json
Normal file
@@ -0,0 +1,19 @@
|
||||
[
|
||||
{
|
||||
"name": "dispose",
|
||||
"type": "checkbox",
|
||||
"label": "是否dispose"
|
||||
},
|
||||
{
|
||||
"name": "timeout",
|
||||
"type": "input-text",
|
||||
"label": "运行时间(秒)",
|
||||
"default": "60"
|
||||
},
|
||||
{
|
||||
"name": "interval",
|
||||
"type": "input-text",
|
||||
"label": "间隔多久输出一次(毫秒)",
|
||||
"default": "1000"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user