|
|
@ -1,10 +1,7 @@
|
|
|
|
export function calculateCPUPercent(stats) {
|
|
|
|
export function calculateCPUPercent(stats) {
|
|
|
|
let cpuPercent = 0.0;
|
|
|
|
let cpuPercent = 0.0;
|
|
|
|
const cpuDelta =
|
|
|
|
const cpuDelta = stats.cpu_stats.cpu_usage.total_usage - stats.precpu_stats.cpu_usage.total_usage;
|
|
|
|
stats.cpu_stats.cpu_usage.total_usage -
|
|
|
|
const systemDelta = stats.cpu_stats.system_cpu_usage - stats.precpu_stats.system_cpu_usage;
|
|
|
|
stats.precpu_stats.cpu_usage.total_usage;
|
|
|
|
|
|
|
|
const systemDelta =
|
|
|
|
|
|
|
|
stats.cpu_stats.system_cpu_usage - stats.precpu_stats.system_cpu_usage;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (systemDelta > 0.0 && cpuDelta > 0.0) {
|
|
|
|
if (systemDelta > 0.0 && cpuDelta > 0.0) {
|
|
|
|
cpuPercent = (cpuDelta / systemDelta) * stats.cpu_stats.online_cpus * 100.0;
|
|
|
|
cpuPercent = (cpuDelta / systemDelta) * stats.cpu_stats.online_cpus * 100.0;
|
|
|
|