Dateien hochladen nach „libs“

This commit is contained in:
2023-02-25 02:06:41 +01:00
parent 074411eeb5
commit 542006d923
11 changed files with 561 additions and 0 deletions

30
libs/load_average.php Normal file
View File

@ -0,0 +1,30 @@
<?php
require '../autoload.php';
if (!($load_tmp = shell_exec('cat /proc/loadavg | awk \'{print $1","$2","$3}\'')))
{
$load = array(0, 0, 0);
}
else
{
// Number of cores
$cores = Misc::getCpuCoresNumber();
$load_exp = explode(',', $load_tmp);
$load = array_map(
function ($value, $cores) {
$v = (int)($value * 100 / $cores);
if ($v > 100)
$v = 100;
return $v;
},
$load_exp,
array_fill(0, 3, $cores)
);
}
$datas = $load;
echo json_encode($datas);