MCPcopy Create free account
hub / github.com/cppla/ServerStatus / detailResourceHTML

Function detailResourceHTML

web/js/app.js:297–305  ·  view source on GitHub ↗
(s, m)

Source from the content-addressed store, hash-verified

295 </div>`;
296}
297function 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}
306function packetLossLine(s){
307 return [s.ping_10010, s.ping_189, s.ping_10086].map(p => `${clamp(num(p), 0, 100).toFixed(0)}%`).join('|');
308}

Callers 1

refreshDetailFunction · 0.85

Calls 5

numFunction · 0.85
resourceMeterFunction · 0.85
humanMinMBFromKBFunction · 0.85
humanMinMBFromMBFunction · 0.85
humanMinMBFromBFunction · 0.85

Tested by

no test coverage detected