Subject: | Mac OS X support |
The patch adds support for Mac OS X, where "uptime" outputs the results in a slightly different format (there are no commas between the load averages).
--- /opt/local/lib/perl5/site_perl/5.8.7/darwin-2level/Sys/CpuLoad.pm 2002-03-18 23:41:39.000000000 +0000
+++ /Users/vinc17/lib/site_perl/Sys/CpuLoad.pm 2005-08-04 22:22:51.000000000 +0000
@@ -83,7 +83,7 @@
if (defined $fh) {
my $line = <$fh>;
$fh->close();
- if ($line =~ /(\d+\.\d+)\s*,\s+(\d+\.\d+)\s*,\s+(\d+\.\d+)\s*$/) {
+ if ($line =~ /(\d+\.\d+)\s*,?\s+(\d+\.\d+)\s*,?\s+(\d+\.\d+)\s*$/) {
return ($1, $2, $3);
} # if we can parse the output of /usr/bin/uptime
} # if we could run /usr/bin/uptime