summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUGS1
-rw-r--r--CHANGELOG10
-rw-r--r--HELP54
-rw-r--r--README4
-rw-r--r--WISHLIST1
-rwxr-xr-xloadbars315
6 files changed, 240 insertions, 145 deletions
diff --git a/BUGS b/BUGS
index 6dae86e..4f27f4b 100644
--- a/BUGS
+++ b/BUGS
@@ -1,2 +1 @@
-* Status messages sometimes have black vertical lines in between
* After quit ssh processes dont shut down instantly but later
diff --git a/CHANGELOG b/CHANGELOG
index 00f5d60..95fb74c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,8 +1,8 @@
-Sat Jan 21 15:54:06 CET 2012
-* Add HELP file
-
-Tue Dec 27 13:04:43 CET 2011
-* Bugfix: Max system+user peak is never >100%
+* Also show stats for idle, iowait, irq, softirq, steal and guest cpu time
+* Some parameters have been renamed (see --help)
+* Introduced extended mode (use --extended 1 at startup or 'e' hotkey)
+* Modified the bar colors a little bit (see --help)
+* Some Bugfixes
Tue Dec 27 12:28:40 CET 2011
* Released v0.3.1
diff --git a/HELP b/HELP
index ead04a7..fe8cfd6 100644
--- a/HELP
+++ b/HELP
@@ -1,30 +1,42 @@
-Explanation colors:
- Blue: System cpu usage
- Purple: System usage if system cpu is >30%
- Yellow: User cpu usage
- Darker yellow: User usage if system & user cpu is >50%
- Orange: User usage if system & user cpu is >70%
- White: Usage usage if system & user cpu is >99%
- Green: Nice cpu usage
- 1px horizontal line: Maximum sy+us cpu of last 'avg' samples
-Explanation text display:
- ni = Nice cpu usage in %
- us = User cpu usage in %
- sy = System cpu sage in %
- su = System & user cpu usage in %
- pk = Max System & user cpu usage peak of last avg. samples in %
- avg = System load average (desc. order: 1, 5 and 15 min. avg.)
---togglecpu <ARG> - Toggle CPUs (0 or 1)
+Explanations:
+ st = Steal in % [see man proc] (extended)
+ Color: Red
+ gt = Guest in % [see man proc] (extended)
+ Color: Red
+ sr = Soft IRQ usage in % (extended)
+ Color: White
+ ir = IRQ usage in % (extended)
+ Color: White
+ io = IOwait cpu sage in %
+ Color: Purple
+ id = Idle cpu usage in % (extended)
+ Color: Black
+ ni = Nice cpu usage in %
+ Color: Green
+ us = User cpu usage in %
+ Color: Yellow, dark yellow if to>50%, orange if to>50%
+ sy = System cpu sage in %
+ Blue, lighter blue if >30%
+ to = Total CPU usage, which is (100% - id)
+ pk = Max us+sy peak of last avg. samples (extended)
+ avg = System load average; desc. order: 1, 5 and 15 min. avg.
+ 1px horizontal line: Maximum sy+us+io of last 'avg' samples (extended)
+ Extended means: text display only if extended mode is turned on
+Examples:
+ loadbars --extended 1 --showcores 1 --width 600 --hosts localhost
+ loadbars --hosts localhost,server1.example.com,server2.example.com
+ loadbars --cluster foocluster (foocluster is in /etc/clusters of cssh)
--average <ARG> - Num of samples for avg. (more fluent animations)
--cluster <ARG> - Cluster name from /etc/clusters
+--extended <ARG> - Toggle extended display (0 or 1)
--factor <ARG> - Set graph scale factor (1.0 means 100%)
--height <ARG> - Set windows height
---hosts <ARG> - Comma separated list of hosts
+--hosts <ARG> - Comma sep. list of hosts; optional: user@ in front to each host
--inter <ARG> - Set update interval in seconds (default 0.1)
--samples <ARG> - Set number of samples until ssh reconnects
+--showcores <ARG> - Toggle core display (0 or 1)
+--showtexthost <ARG> - Toggle hostname/num text display (0 or 1)
+--showtext <ARG> - Toggle text display (0 or 1)
--sshopts <ARG> - Set SSH options
--title <ARG> - Set the window title
---toggletxthost <ARG> - Toggle hostname/num text display (0 or 1)
---togglepeak <ARG> - Toggle peak display (0 or 1)
---toggletxt <ARG> - Toggle text display (0 or 1)
--width <ARG> - Set windows width
diff --git a/README b/README
index 6b86bf3..dbfe164 100644
--- a/README
+++ b/README
@@ -11,7 +11,9 @@ For a changelog see CHANGELOG
For a list of all known bugs see BUGS
-Supported platforms are: Linux and FreeBSD (the latter with linprocfs mounted)
+Supported platforms are: Linux and FreeBSD (the latter with linprocfs mounted).
+
+For Linux at least a 2.6 Kernel is required.
Versioning schema: a.b.c[.d], where
d = Optional, bugfixes only release
diff --git a/WISHLIST b/WISHLIST
index 9a9ee12..a309f07 100644
--- a/WISHLIST
+++ b/WISHLIST
@@ -1,3 +1,4 @@
+* Local configuration file for default values
* Stats for memory
* Stats for network
* Dynamic/online resizing of the window
diff --git a/loadbars b/loadbars
index 121ebe6..246a7d4 100755
--- a/loadbars
+++ b/loadbars
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# loadbars (c) 2010 - 2011, Dipl.-Inform. (FH) Paul Buetow
+# loadbars (c) 2010 - 2012, Dipl.-Inform. (FH) Paul Buetow
# E-Mail: loadbars@mx.buetow.org WWW: http://loadbars.buetow.org
# For legal informations see COPYING and COPYING.FONT
@@ -25,24 +25,24 @@ use threads;
use threads::shared;
use constant {
- DEPTH => 8,
- VERSION => 'loadbars v0.3.1-master',
+ VERSION => 'loadbars v0.4.0-devel',
Copyright => '2010-2011 (c) Paul Buetow <loadbars@mx.buetow.org>',
CSSH_CONFFILE => '/etc/clusters',
- CSSH_MAX_RECURSION => 10,
+ CSSH_MAX_RECURSION => 10,
+ COLOR_DEPTH => 8,
BLACK => SDL::Color->new(-r => 0x00, -g => 0x00, -b => 0x00),
- BLUE => SDL::Color->new(-r => 0x00, -g => 0x00, -b => 0xff),
+ BLUE0=> SDL::Color->new(-r => 0x00, -g => 0x00, -b => 0xff),
+ BLUE => SDL::Color->new(-r => 0x00, -g => 0x00, -b => 0x88),
GREEN => SDL::Color->new(-r => 0x00, -g => 0x90, -b => 0x00),
ORANGE => SDL::Color->new(-r => 0xff, -g => 0x70, -b => 0x00),
PURPLE => SDL::Color->new(-r => 0xa0, -g => 0x20, -b => 0xf0),
RED => SDL::Color->new(-r => 0xff, -g => 0x00, -b => 0x00),
WHITE => SDL::Color->new(-r => 0xff, -g => 0xff, -b => 0xff),
+ GREY0 => SDL::Color->new(-r => 0x11, -g => 0x11, -b => 0x11),
GREY => SDL::Color->new(-r => 0xaa, -g => 0xaa, -b => 0xaa),
YELLOW0 => SDL::Color->new(-r => 0xff, -g => 0xa0, -b => 0x00),
YELLOW => SDL::Color->new(-r => 0xff, -g => 0xc0, -b => 0x00),
- SYSTEM_PURPLE => 30,
- USER_WHITE => 99,
- USER_RED => 90,
+ SYSTEM_BLUE0 => 30,
USER_ORANGE => 70,
USER_YELLOW0 => 50,
NULL => 0,
@@ -60,19 +60,19 @@ my %C : shared;
# Setting defaults
%C = (
- title => Loadbars::VERSION . ' (press h for help)',
- average => 15,
- togglecpu => 1,
+ title => Loadbars::VERSION . ' (press h for help on stdout)',
+ average => 15,
+ showcores => 0,
cpuregexp => 'cpu',
factor => 1,
+ extended => 0,
displaytxt => 1,
displaytxthost => 0,
- togglepeak => 0,
inter => 0.1,
samples => 1000,
sshopts => '',
width => 1250,
- height => 150,
+ height => 230,
);
# Quick n dirty helpers
@@ -81,14 +81,26 @@ sub newline () { say ''; return undef }
sub debugsay (@) { say "Loadbars::DEBUG: $_" for @_; return undef }
sub sum (@) { my $sum = 0; $sum += $_ for @_; return $sum }
sub null ($) { my $arg = shift; return defined $arg ? $arg : 0 }
-sub set_togglecpu_regexp () { $C{cpuregexp} = $C{togglecpu} ? 'cpu ' : 'cpu' }
+sub set_showcores_regexp () { $C{cpuregexp} = $C{showcores} ? 'cpu' : 'cpu ' }
sub error ($) { die shift, "\n" }
+sub norm ($) {
+ my $n = shift;
+
+ return $n if $C{factor} != 1;
+ return $n > 100 ? 100 : ($n < 0 ? 0 : $n);
+}
+
sub parse_cpu_line ($) {
+ my $line = shift;
my ($name, %load);
- ($name, @load{qw(user nice system iowait irq softirq)}) = split ' ', shift;
- $load{TOTAL} = sum @load{qw(user nice system iowait)};
+ ($name, @load{qw(user nice system idle iowait irq softirq steal guest)}) = split ' ', $line;
+
+ $load{steal} = 0 unless defined $load{steal};
+ $load{guest} = 0 unless defined $load{guest};
+
+ $load{TOTAL} = sum @load{qw(user nice system idle iowait irq softirq steal guest)};
return ($name, \%load);
}
@@ -228,7 +240,7 @@ sub main_loop ($@) {
-icon_title => $C{title},
-width => $C{width},
-height => $C{height},
- -depth => Loadbars::DEPTH,
+ -depth => Loadbars::COLOR_DEPTH,
-resizeable => 0,
);
@@ -265,22 +277,22 @@ sub main_loop ($@) {
next if $type != 2;
if ($key_name eq '1') {
- $C{togglecpu} = !$C{togglecpu};
- set_togglecpu_regexp;
+ $C{showcores} = !$C{showcores};
+ set_showcores_regexp;
$_->kill('USR1') for @threads;
%AVGSTATS = ();
%CPUSTATS = ();
$displayinfo = 'Toggled CPUs';
+ } elsif ($key_name eq 'e') {
+ $C{extended} = !$C{extended};
+ $displayinfo = 'Toggled extended display';
+
} elsif ($key_name eq 'h') {
say '=> Hotkeys to use in the SDL interface';
say $dispatch->('hotkeys');
$displayinfo = 'Hotkeys help printed on terminal stdout';
- } elsif ($key_name eq 'p') {
- $C{togglepeak} = !$C{togglepeak};
- $displayinfo = 'Toggled peak display';
-
} elsif ($key_name eq 't') {
$C{displaytxt} = !$C{displaytxt};
$displayinfo = 'Toggled text display';
@@ -380,13 +392,20 @@ sub main_loop ($@) {
my $is_host_summary = exists $is_host_summary{$host};
my $rect_separator = undef;
+
+ my $rect_idle = get_rect $rects, "$key;idle";
+ my $rect_steal = get_rect $rects, "$key;steal";
+ my $rect_guest = get_rect $rects, "$key;guest";
+ my $rect_irq = get_rect $rects, "$key;irq";
+ my $rect_softirq = get_rect $rects, "$key;softirq";
+ my $rect_nice = get_rect $rects, "$key;nice";
+ my $rect_iowait = get_rect $rects, "$key;iowait";
my $rect_user = get_rect $rects, "$key;user";
my $rect_system = get_rect $rects, "$key;system";
- my $rect_iowait = get_rect $rects, "$key;iowait";
- my $rect_nice = get_rect $rects, "$key;nice";
+
my $rect_peak;
- unless ($is_host_summary || $C{togglecpu}) {
+ unless ($is_host_summary || !$C{showcores}) {
$current_corenum = 0;
$rect_separator = get_rect $rects, "$key;separator";
$rect_separator->width(1);
@@ -414,53 +433,76 @@ sub main_loop ($@) {
$rect_nice->x($x);
$rect_nice->y($y);
+ $y -= $heights{idle};
+ $rect_idle->width($width);
+ $rect_idle->height($heights{idle});
+ $rect_idle->x($x);
+ $rect_idle->y($y);
+
$y -= $heights{iowait};
$rect_iowait->width($width);
$rect_iowait->height($heights{iowait});
$rect_iowait->x($x);
$rect_iowait->y($y);
-
- my $system_n_user = sum @{$cpuaverage}{qw(user system)};
- my $max_system_n_user = 0;
- $app->fill($rect_iowait, Loadbars::BLACK);
+ $y -= $heights{irq};
+ $rect_irq->width($width);
+ $rect_irq->height($heights{irq});
+ $rect_irq->x($x);
+ $rect_irq->y($y);
+
+ $y -= $heights{softirq};
+ $rect_softirq->width($width);
+ $rect_softirq->height($heights{softirq});
+ $rect_softirq->x($x);
+ $rect_softirq->y($y);
+
+ $y -= $heights{guest};
+ $rect_guest->width($width);
+ $rect_guest->height($heights{guest});
+ $rect_guest->x($x);
+ $rect_guest->y($y);
+
+ $y -= $heights{steal};
+ $rect_steal->width($width);
+ $rect_steal->height($heights{steal});
+ $rect_steal->x($x);
+ $rect_steal->y($y);
+
+ my $all = 100 - $cpuaverage->{idle};
+ my $max_all = 0;
+
+ $app->fill($rect_idle, Loadbars::BLACK);
+ $app->fill($rect_steal, Loadbars::RED);
+ $app->fill($rect_guest, Loadbars::RED);
+ $app->fill($rect_irq, Loadbars::WHITE);
+ $app->fill($rect_softirq, Loadbars::WHITE);
$app->fill($rect_nice, Loadbars::GREEN);
-
- if ($C{togglepeak}) {
- my %maxheights = map {
- $_ => defined $cpumax->{$_} ? $cpumax->{$_} * ($C{height}/100) : 1
-
- } keys %$cpumax;
-
- $rect_peak = get_rect $rects, "$key;max";
- $rect_peak->width($width);
- $rect_peak->height(1);
- $rect_peak->x($x);
- $rect_peak->y($C{height} - $maxheights{system} - $maxheights{user});
-
- $max_system_n_user = sum @{$cpumax}{qw(user system)};
- $max_system_n_user = 100 if $max_system_n_user > 100;
-
- $app->fill($rect_peak, $max_system_n_user > Loadbars::USER_WHITE ? Loadbars::WHITE
- : ($max_system_n_user > Loadbars::USER_RED ? Loadbars::RED
- : ($max_system_n_user > Loadbars::USER_ORANGE ? Loadbars::ORANGE
- : ($max_system_n_user > Loadbars::USER_YELLOW0 ? Loadbars::YELLOW0
- : (Loadbars::YELLOW)))));
- }
-
- $app->fill($rect_user, $system_n_user > Loadbars::USER_WHITE ? Loadbars::WHITE
- : ($system_n_user > Loadbars::USER_RED ? Loadbars::RED
- : ($system_n_user > Loadbars::USER_ORANGE ? Loadbars::ORANGE
- : ($system_n_user > Loadbars::USER_YELLOW0 ? Loadbars::YELLOW0
- : (Loadbars::YELLOW)))));
- $app->fill($rect_system, $cpuaverage->{system} > Loadbars::SYSTEM_PURPLE
- ? Loadbars::PURPLE
+ $app->fill($rect_iowait, Loadbars::PURPLE);
+
+ if ($C{extended}) {
+ my %maxheights = map {
+ $_ => defined $cpumax->{$_} ? $cpumax->{$_} * ($C{height}/100) : 1
+ } keys %$cpumax;
+
+ $rect_peak = get_rect $rects, "$key;max";
+ $rect_peak->width($width);
+ $rect_peak->height(1);
+ $rect_peak->x($x);
+ $rect_peak->y($C{height} - $maxheights{system} - $maxheights{user});
+
+ $max_all = sum @{$cpumax}{qw(user system iowait irq softirq steal guest)};
+
+ $app->fill($rect_peak, $max_all > Loadbars::USER_ORANGE ? Loadbars::ORANGE
+ : ($max_all > Loadbars::USER_YELLOW0 ? Loadbars::YELLOW0
+ : (Loadbars::YELLOW)));
+ }
+
+ $app->fill($rect_user, $all > Loadbars::USER_ORANGE ? Loadbars::ORANGE
+ : ($all > Loadbars::USER_YELLOW0 ? Loadbars::YELLOW0
+ : (Loadbars::YELLOW)));
+ $app->fill($rect_system, $cpuaverage->{system} > Loadbars::SYSTEM_BLUE0 ? Loadbars::BLUE0
: Loadbars::BLUE);
- $app->fill($rect_user, $system_n_user > Loadbars::USER_WHITE ? Loadbars::WHITE
- : ($system_n_user > Loadbars::USER_RED ? Loadbars::RED
- : ($system_n_user > Loadbars::USER_ORANGE ? Loadbars::ORANGE
- : ($system_n_user > Loadbars::USER_YELLOW0 ? Loadbars::YELLOW0
- : (Loadbars::YELLOW)))));
my ($y, $space) = (5, $font_height);
my @loadavg = split ';', $AVGSTATS{$host};
@@ -475,31 +517,57 @@ sub main_loop ($@) {
} else {
$app->print($x, $y, sprintf '%i:',
- $C{togglecpu} ? $current_barnum + 1: $current_corenum);
+ $C{showcores} ? $current_corenum : $current_barnum + 1);
}
- $app->print($x, $y+=$space, sprintf '%d%s', $cpuaverage->{nice}, 'ni');
- $app->print($x, $y+=$space, sprintf '%d%s', $cpuaverage->{user}, 'us');
- $app->print($x, $y+=$space, sprintf '%d%s', $cpuaverage->{system}, 'sy');
- $app->print($x, $y+=$space, sprintf '%d%s', $system_n_user, 'su');
- $app->print($x, $y+=$space, sprintf '%d%s', $max_system_n_user, 'pk')
- if $C{togglepeak};
-
- unless ($is_host_summary) {
- if (defined $loadavg[0]) {
- $app->print($x, $y+=$space, 'avg:');
- $app->print($x, $y+=$space, sprintf "%.2f", $loadavg[0]);
- $app->print($x, $y+=$space, sprintf "%.2f", $loadavg[1]);
- $app->print($x, $y+=$space, sprintf "%.2f", $loadavg[2]);
- }
-
- }
+
+ if ($C{extended}) {
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $cpuaverage->{steal}, 'st');
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $cpuaverage->{guest}, 'gt');
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $cpuaverage->{softirq}, 'sr');
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $cpuaverage->{irq}, 'ir');
+ }
+
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $cpuaverage->{iowait}, 'io');
+
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $cpuaverage->{idle}, 'id') if $C{extended};
+
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $cpuaverage->{nice}, 'ni');
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $cpuaverage->{user}, 'us');
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $cpuaverage->{system}, 'sy');
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $all, 'to');
+
+ $app->print($x, $y+=$space, sprintf '%02d%s', norm $max_all, 'pk') if $C{extended};
+
+ unless ($is_host_summary) {
+ if (defined $loadavg[0]) {
+ $app->print($x, $y+=$space, 'avg:');
+ $app->print($x, $y+=$space, sprintf "%.2f", $loadavg[0]);
+ $app->print($x, $y+=$space, sprintf "%.2f", $loadavg[1]);
+ $app->print($x, $y+=$space, sprintf "%.2f", $loadavg[2]);
+ }
+ }
}
# Display an informational text message if any
- $app->print(0, $y+=$space, $displayinfo) if length $displayinfo;
+ #$app->print(0, $y+=$space, $displayinfo) if length $displayinfo;
+ if (length $displayinfo) {
+ say $displayinfo;
+ $displayinfo = '';
+ }
- $app->update($rect_nice, $rect_iowait, $rect_system, $rect_user);
+ $app->update(
+ $rect_idle,
+ $rect_iowait,
+ $rect_irq,
+ $rect_nice,
+ $rect_softirq,
+ $rect_steal,
+ $rect_guest,
+ $rect_system,
+ $rect_user,
+ );
+
$app->update($rect_separator) if defined $rect_separator;
$x += $width + 1;
@@ -522,7 +590,7 @@ TIMEKEEPER:
if ($C{inter} > $t2 - $t1) {
usleep 10000;
- # Goto is OK if you don't produce spaghetti code with it
+ # Goto is OK if you don't produce spaghetti code
goto TIMEKEEPER;
}
@@ -546,22 +614,34 @@ sub dispatch_table () {
my $hosts = '';
my $textdesc = <<END;
-Explanation colors:
- Blue: System cpu usage
- Purple: System usage if system cpu is >30%
- Yellow: User cpu usage
- Darker yellow: User usage if system & user cpu is >50%
- Orange: User usage if system & user cpu is >70%
- White: Usage usage if system & user cpu is >99%
- Green: Nice cpu usage
- 1px horizontal line: Maximum sy+us cpu of last 'avg' samples
-Explanation text display:
- ni = Nice cpu usage in %
- us = User cpu usage in %
- sy = System cpu sage in %
- su = System & user cpu usage in %
- pk = Max System & user cpu usage peak of last avg. samples in %
- avg = System load average (desc. order: 1, 5 and 15 min. avg.)
+Explanations:
+ st = Steal in % [see man proc] (extended)
+ Color: Red
+ gt = Guest in % [see man proc] (extended)
+ Color: Red
+ sr = Soft IRQ usage in % (extended)
+ Color: White
+ ir = IRQ usage in % (extended)
+ Color: White
+ io = IOwait cpu sage in %
+ Color: Purple
+ id = Idle cpu usage in % (extended)
+ Color: Black
+ ni = Nice cpu usage in %
+ Color: Green
+ us = User cpu usage in %
+ Color: Yellow, dark yellow if to>50%, orange if to>50%
+ sy = System cpu sage in %
+ Blue, lighter blue if >30%
+ to = Total CPU usage, which is (100% - id)
+ pk = Max us+sy peak of last avg. samples (extended)
+ avg = System load average; desc. order: 1, 5 and 15 min. avg.
+ 1px horizontal line: Maximum sy+us+io of last 'avg' samples (extended)
+ Extended means: text display only if extended mode is turned on
+Examples:
+ loadbars --extended 1 --showcores 1 --width 600 --hosts localhost
+ loadbars --hosts localhost,server1.example.com,server2.example.com
+ loadbars --cluster foocluster (foocluster is in /etc/clusters of cssh)
END
# mode 1: Option is shown in the online help menu (stdout not sdl)
@@ -570,9 +650,6 @@ END
# Combinations: Like chmod(1)
my %d = (
- togglecpu => { menupos => 1, help => 'Toggle CPUs (0 or 1)', mode => 7, type => 'i' },
- togglecpu_hot => { menupos => 2, cmd => '1', help => 'Toggle CPUs', mode => 1 },
-
average => { menupos => 3, help => 'Num of samples for avg. (more fluent animations)', mode => 6, type => 'i' },
average_hot_up => { menupos => 4, cmd => 'a', help => 'Increases number of samples for calculating avg. by 1', mode => 1 },
average_hot_dn => { menupos => 5, cmd => 'y', help => 'Decreases number of samples for calculating avg. by 1', mode => 1 },
@@ -580,6 +657,9 @@ END
cluster => { menupos => 6, help => 'Cluster name from /etc/clusters', var => \$C{cluster}, mode => 6, type => 's' },
configuration => { menupos => 6, cmd => 'c', help => 'Show current configuration', mode => 4 },
+ extended => { menupos => 6, help => 'Toggle extended display (0 or 1)', mode => 7, type => 'i' },
+ extended_hot => { menupos => 23, cmd => 'e', help => 'Toggle peak display', mode => 1 },
+
factor => { menupos => 7, help => 'Set graph scale factor (1.0 means 100%)', mode => 6, type => 's' },
factor_hot_up => { menupos => 8, cmd => 's', help => 'Increases graph scale factor by 0.1', mode => 1 },
factor_hot_dn => { menupos => 9, cmd => 'x', help => 'Decreases graph scale factor by 0.1', mode => 1 },
@@ -588,7 +668,7 @@ END
help_hot => { menupos => 11, cmd => 'h', help => 'Prints this help screen', mode => 1 },
- hosts => { menupos => 12, help => 'Comma separated list of hosts', var => \$hosts, mode => 6, type => 's' },
+ hosts => { menupos => 12, help => 'Comma sep. list of hosts; optional: user@ in front to each host', var => \$hosts, mode => 6, type => 's' },
inter => { menupos => 13, help => 'Set update interval in seconds (default 0.1)', mode => 7, type => 's' },
inter_hot_up => { menupos => 14, cmd => 'd', help => 'Increases update interval in seconds by 0.1', mode => 1 },
@@ -597,17 +677,18 @@ END
quit_hot => { menupos => 16, cmd => 'q', help => 'Quits', mode => 1 },
samples => { menupos => 17, help => 'Set number of samples until ssh reconnects', mode => 6, type => 'i' },
- sshopts => { menupos => 18, help => 'Set SSH options', mode => 6, type => 's' },
- title => { menupos => 19, help => 'Set the window title', var => \$C{title}, mode => 6, type => 's' },
- toggletxthost => { menupos => 20, help => 'Toggle hostname/num text display (0 or 1)', mode => 7, type => 'i' },
- toggletxthost_hot => { menupos => 21, cmd => 'u', help => 'Toggle hostname/num text display', mode => 1 },
+ showcores => { menupos => 17, help => 'Toggle core display (0 or 1)', mode => 7, type => 'i' },
+ showcores_hot => { menupos => 17, cmd => '1', help => 'Toggle CPUs', mode => 1 },
+
+ showtexthost => { menupos => 18, help => 'Toggle hostname/num text display (0 or 1)', mode => 7, type => 'i' },
+ showtexthost_hot => { menupos => 18, cmd => 'u', help => 'Toggle hostname/num text display', mode => 1 },
- toggletxt => { menupos => 22, help => 'Toggle text display (0 or 1)', mode => 7, type => 'i' },
- toggletxt_hot => { menupos => 23, cmd => 't', help => 'Toggle text display', mode => 1 },
+ showtext => { menupos => 19, help => 'Toggle text display (0 or 1)', mode => 7, type => 'i' },
+ showtext_hot => { menupos => 19, cmd => 't', help => 'Toggle text display', mode => 1 },
- togglepeak => { menupos => 22, help => 'Toggle peak display (0 or 1)', mode => 7, type => 'i' },
- togglepeak_hot => { menupos => 23, cmd => 'p', help => 'Toggle peak display', mode => 1 },
+ sshopts => { menupos => 20, help => 'Set SSH options', mode => 6, type => 's' },
+ title => { menupos => 21, help => 'Set the window title', var => \$C{title}, mode => 6, type => 's' },
width => { menupos => 24, help => 'Set windows width', mode => 6, type => 'i' },
);
@@ -733,10 +814,10 @@ sub main () {
if (defined $usage) {
say $dispatch->('usage');
- exit 0;
+ exit 1;
}
- set_togglecpu_regexp;
+ set_showcores_regexp;
my @hosts = map {
my ($a, $b) = split /\@/, $_;
@@ -748,10 +829,10 @@ sub main () {
system 'ssh-add';
} else {
- @hosts = 'localhost';
+ say $dispatch->('usage');
+ exit 1;
}
-
my @threads = create_threads @hosts;
main_loop $dispatch, @threads;
}