分开上下行统计
This commit is contained in:
@@ -19,7 +19,8 @@
|
||||
memDetail: document.getElementById('memDetail'),
|
||||
diskPercent: document.getElementById('diskPercent'),
|
||||
diskDetail: document.getElementById('diskDetail'),
|
||||
totalBandwidth: document.getElementById('totalBandwidth'),
|
||||
totalBandwidthTx: document.getElementById('totalBandwidthTx'),
|
||||
totalBandwidthRx: document.getElementById('totalBandwidthRx'),
|
||||
bandwidthDetail: document.getElementById('bandwidthDetail'),
|
||||
traffic24hRx: document.getElementById('traffic24hRx'),
|
||||
traffic24hTx: document.getElementById('traffic24hTx'),
|
||||
@@ -570,8 +571,9 @@
|
||||
dom.diskDetail.textContent = `${formatBytes(data.disk.used)}/${formatBytes(data.disk.total)}`;
|
||||
|
||||
// Bandwidth
|
||||
dom.totalBandwidth.textContent = formatBandwidth(data.network.total || 0);
|
||||
dom.bandwidthDetail.textContent = `↓ ${formatBandwidth(data.network.rx)} ↑ ${formatBandwidth(data.network.tx)}`;
|
||||
dom.totalBandwidthTx.textContent = formatBandwidth(data.network.tx || 0);
|
||||
dom.totalBandwidthRx.textContent = formatBandwidth(data.network.rx || 0);
|
||||
dom.bandwidthDetail.textContent = `当前实时数据聚合`;
|
||||
|
||||
// 24h traffic
|
||||
dom.traffic24hRx.textContent = formatBytes(data.traffic24h.rx);
|
||||
@@ -586,7 +588,7 @@
|
||||
|
||||
// Flash animation
|
||||
if (previousMetrics) {
|
||||
[dom.cpuPercent, dom.memPercent, dom.diskPercent, dom.totalBandwidth].forEach(el => {
|
||||
[dom.cpuPercent, dom.memPercent, dom.diskPercent, dom.totalBandwidthTx, dom.totalBandwidthRx].forEach(el => {
|
||||
el.classList.remove('value-update');
|
||||
void el.offsetWidth; // Force reflow
|
||||
el.classList.add('value-update');
|
||||
|
||||
@@ -49,9 +49,8 @@ class AreaChart {
|
||||
}
|
||||
|
||||
// Calculate P95 (95th percentile)
|
||||
// Common standard: 95th percentile of the peak (max of rx/tx or sum)
|
||||
// We'll use max(rx, tx) at each point which is common for billing
|
||||
const combined = data.rx.map((r, i) => Math.max(r || 0, data.tx[i] || 0));
|
||||
// Updated: Only count Upstream (TX) as requested
|
||||
const combined = data.tx.map(t => t || 0);
|
||||
if (combined.length > 0) {
|
||||
const sorted = [...combined].sort((a, b) => a - b);
|
||||
const p95Idx = Math.floor(sorted.length * 0.95);
|
||||
|
||||
Reference in New Issue
Block a user