summaryrefslogtreecommitdiff
path: root/loadbars.pl
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2011-08-06 20:24:01 +0000
committerPaul Buetow <paul@buetow.org>2011-08-06 20:24:01 +0000
commitc627a59b2a78644aec256f0e0fc96531fff8a9dc (patch)
tree4d7f7134c6f6b753b4fedec686ffe4825122d7e1 /loadbars.pl
parent48099cfd7f6de476bd60681c3fc0ebcec83d3893 (diff)
initial v0.2.1
Diffstat (limited to 'loadbars.pl')
-rwxr-xr-xloadbars.pl25
1 files changed, 23 insertions, 2 deletions
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 <loadbars@mx.buetow.org>',
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);