This commit is contained in:
2018-12-04 10:48:02 -05:00
parent 5573bbb562
commit 146ffb643e
9 changed files with 22 additions and 13 deletions

View File

@@ -29,7 +29,7 @@ GetOptions("help|h" => \&help,
# Get CPU usage
$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
open (MPSTAT, 'mpstat |') or die;
open (MPSTAT, 'mpstat 1 1 -P ALL |') or die;
while (<MPSTAT>) {
if (/^.*\s+(\d+\.\d+)\s+$/) {
$cpu_usage = 100 - $1; # 100% - %idle