(s, m)
| 295 | </div>`; |
| 296 | } |
| 297 | function detailResourceHTML(s, m){ |
| 298 | const swapPct = s.swap_total ? num(s.swap_used) / num(s.swap_total) * 100 : 0; |
| 299 | return ` |
| 300 | ${resourceMeter('CPU', `${num(s.cpu).toFixed(0)}%`, num(s.cpu), 'cpu')} |
| 301 | ${resourceMeter('内存', `${humanMinMBFromKB(s.memory_used)} / ${humanMinMBFromKB(s.memory_total)}`, m.memPct, 'mem')} |
| 302 | ${resourceMeter('虚存', `${humanMinMBFromKB(s.swap_used)} / ${humanMinMBFromKB(s.swap_total)}`, swapPct, 'swap')} |
| 303 | ${resourceMeter('硬盘', `${humanMinMBFromMB(s.hdd_used)} / ${humanMinMBFromMB(s.hdd_total)}`, m.hddPct, 'hdd')} |
| 304 | <div class="resource-mini"><span>IO</span><strong>读 ${humanMinMBFromB(s.io_read)} / 写 ${humanMinMBFromB(s.io_write)}</strong></div>`; |
| 305 | } |
| 306 | function packetLossLine(s){ |
| 307 | return [s.ping_10010, s.ping_189, s.ping_10086].map(p => `${clamp(num(p), 0, 100).toFixed(0)}%`).join('|'); |
| 308 | } |
no test coverage detected