🪄 修改默认的10秒刷新为30秒

This commit is contained in:
hi2hi 2024-12-10 15:59:01 +00:00
parent bd6b3c8b44
commit 247115c3c3
2 changed files with 10 additions and 2 deletions

View File

@ -157,9 +157,9 @@ async function setTimeLoadMonitor() {
if (monitorRefreshTime === 0) {
return;
}
// 10
// 30
if (Number.isNaN(monitorRefreshTime)) {
monitorRefreshTime = 10;
monitorRefreshTime = 30;
}
// 10
const sTime = Math.min(monitorRefreshTime, 10);

View File

@ -8,13 +8,21 @@
* @property {number} mean - 数据的平均值
*/
export function getThreshold(data, tolerance = 2) {
// 计算数据的平均值
const mean = data.reduce((sum, value) => sum + value, 0) / data.length;
// 计算数据的方差
const variance = data.reduce((sum, value) => sum + (value - mean) ** 2, 0) / data.length;
// 计算标准差
const stdDev = Math.sqrt(variance);
// 计算阈值
const threshold = tolerance * stdDev;
// 过滤掉值为0的数据
const filteredData = data.filter((value) => value !== 0);
// 计算过滤后数据的最小值
const min = Math.min(...filteredData);
// 计算过滤后数据的最大值
const max = Math.max(...filteredData);
// 返回包含阈值、平均值、最小值和最大值的对象
return {
threshold,
mean,