Skip to content

Commit

Permalink
Improve code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
webeweb committed May 17, 2022
1 parent a5143e2 commit 4209f9e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/Helper/OSHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ public static function getCpu(): ?Cpu {
return null;
}

$grep = "%Cpu(s):";
exec("top -b -n 1 |grep '$grep'", $output);
exec("top -b -n 1 |grep '%Cpu(s):'", $output);

preg_match_all("/[0-9.]+/", $output[0], $values);
preg_match_all("/[\d.]+/", $output[0], $values);

$cpu = new Cpu();
$cpu->setUs(floatval(trim($values[0][0])));
Expand Down

0 comments on commit 4209f9e

Please sign in to comment.