mirror of
https://github.com/hi2shark/nazhua.git
synced 2026-01-14 16:20:44 +08:00
🪄 修改默认的10秒刷新为30秒
This commit is contained in:
parent
bd6b3c8b44
commit
247115c3c3
@ -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);
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user