diff options
| author | Paul Buetow <paul@buetow.org> | 2010-11-07 14:47:31 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2010-11-07 14:47:31 +0000 |
| commit | e78f5366195d5fec2e9b51404faaf70042552f8c (patch) | |
| tree | 4a41829d78fb703c7152858f4415b348e5baea50 /cpuload.pl | |
| parent | 3d89a1f24c10b33923717690f878a463f66e2c04 (diff) | |
getopt support
Diffstat (limited to 'cpuload.pl')
| -rwxr-xr-x | cpuload.pl | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -7,6 +7,8 @@ use warnings; use IPC::Open2; use Data::Dumper; +use Getopt::Long; + use SDL::App; use SDL::Rect; use SDL::Color; @@ -235,7 +237,7 @@ sub graph_stats ($$) { $app->fill($rect_iowait, $colors->{black}); $app->fill($rect_nice, $colors->{green}); $app->fill($rect_system, $colors->{blue}); - $app->fill($rect_system, $load_average{system} > 20 + $app->fill($rect_system, $load_average{system} > 30 ? $colors->{purple} : $colors->{blue}); $app->fill($rect_user, $system_n_user > 90 @@ -335,10 +337,12 @@ q - Quit END } -sub main (@_) { - my @hosts = @_; - +sub main () { + my $hosts = ''; + GetOptions ('hosts=s' => \$hosts); + my @hosts = split ',', $hosts; @hosts = 'localhost' unless @hosts; + my ($display, @threads) = create_threads @hosts; say VERSION . ' ' . COPYRIGHT; @@ -364,6 +368,6 @@ sub main (@_) { exit 0; } -main @ARGV; +main; |
