From c627a59b2a78644aec256f0e0fc96531fff8a9dc Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Aug 2011 20:24:01 +0000 Subject: initial v0.2.1 --- WISHLIST | 1 + loadbars.pl | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/WISHLIST b/WISHLIST index 0ff20b6..1641641 100644 --- a/WISHLIST +++ b/WISHLIST @@ -1,3 +1,4 @@ * Stats for other stuff (e.g. memory, inodes..., disk usage) * Dynamic/online resizing of the window * Rudimentary support for /etc/clusters, the Cluster-SSH configuration file +* Adding and removing hosts online diff --git a/loadbars.pl b/loadbars.pl index 3ea7c83..0413542 100755 --- a/loadbars.pl +++ b/loadbars.pl @@ -51,7 +51,7 @@ use IO::Socket; use constant { DEPTH => 8, - VERSION => 'loadbars v0.2.0', + VERSION => 'loadbars v0.2.1-devel', COPYRIGHT => '2010-2011 (c) Paul Buetow ', BLACK => SDL::Color->new(-r => 0x00, -g => 0x00, -b => 0x00), BLUE => SDL::Color->new(-r => 0x00, -g => 0x00, -b => 0xff), @@ -68,7 +68,7 @@ use constant { USER_ORANGE => 70, USER_YELLOW0 => 50, NULL => 0, - DEBUG => 1, + DEBUG => 0, }; $| = 1; @@ -101,6 +101,27 @@ sub sum (@) { my $sum = 0; $sum += $_ for @_; return $sum } sub null ($) { my $arg = shift; return defined $arg ? $arg : 0 } sub set_togglecpu_regexp () { $CONF{cpuregexp} = $CONF{togglecpu} ? 'cpu ' : 'cpu' } +sub unix_make_server_socket ($) { + my $socket_name = shift; + unlink $socket_name; + + return IO::Socket::UNIX->new( + LocalAddr => $socket_name, + Type => SOCK_DGRAM, + Listen => 5 + ) or die "$@\n"; +} + +sub unix_make_client_socket ($) { + my $socket_name = shift; + + return IO::Socket::UNIX->new( + PeerAddr => $socket_name, + Type => SOCK_DGRAM, + Timeout => 10 + ) or die "$@\n"; +} + sub parse_cpu_line ($) { my ($name, %load); -- cgit v1.2.3