mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
Add Docker, Emby, Gotify, Jackett, and JellySeerr widgets
This commit is contained in:
11
src/widgets/docker/stats-helpers.js
Normal file
11
src/widgets/docker/stats-helpers.js
Normal file
@@ -0,0 +1,11 @@
|
||||
export default function calculateCPUPercent(stats) {
|
||||
let cpuPercent = 0.0;
|
||||
const cpuDelta = stats.cpu_stats.cpu_usage.total_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) {
|
||||
cpuPercent = (cpuDelta / systemDelta) * stats.cpu_stats.online_cpus * 100.0;
|
||||
}
|
||||
|
||||
return Math.round(cpuPercent * 10) / 10;
|
||||
}
|
||||
Reference in New Issue
Block a user