diff options
| author | Paul Buetow <paul@buetow.org> | 2026-02-13 20:48:13 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-02-13 20:48:13 +0200 |
| commit | bd095a1b9a2027a1ff43fe4b6fa04d0354ca062c (patch) | |
| tree | ed4c8fad86c1b8347cc86020e0793822ae76a788 /lib/Loadbars | |
| parent | 20e3db5bcb04bc57377432126404b5e99d0b0a92 (diff) | |
Convert POD documentation to Markdown and migrate to Justfile
- Convert all POD files to Markdown format
- Replace Makefile with justfile for build automation
- Remove deprecated Debian packaging files and related directories
- Update copyright year from 2013 to 2026 in Constants.pm and loadbars
- Remove obsolete docs directory (bugs, wishlist, and generated files)
- Fix sum() function in Utils.pm to handle undef values properly
Diffstat (limited to 'lib/Loadbars')
| -rw-r--r-- | lib/Loadbars/Constants.pm | 2 | ||||
| -rw-r--r-- | lib/Loadbars/Main.pm | 8 | ||||
| -rw-r--r-- | lib/Loadbars/Utils.pm | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/lib/Loadbars/Constants.pm b/lib/Loadbars/Constants.pm index 8f6a6d3..36e0a91 100644 --- a/lib/Loadbars/Constants.pm +++ b/lib/Loadbars/Constants.pm @@ -6,7 +6,7 @@ use warnings; use SDL::Color; use constant { - COPYRIGHT => '2010-2013 (c) Paul Buetow <loadbars@dev.buetow.org>', + COPYRIGHT => '2010-2026 (c) Paul Buetow <loadbars@dev.buetow.org>', CONFFILE => $ENV{HOME} . '/.loadbarsrc', CSSH_CONFFILE => '/etc/clusters', CSSH_MAX_RECURSION => 10, diff --git a/lib/Loadbars/Main.pm b/lib/Loadbars/Main.pm index f53bad8..4b750dc 100644 --- a/lib/Loadbars/Main.pm +++ b/lib/Loadbars/Main.pm @@ -60,15 +60,17 @@ sub cpu_parse_line ($) { my $line = shift; my ( $name, %load ); - ( $name, @load{qw(user nice system idle iowait irq softirq steal guest)} ) = + # Modern kernels (2.6.33+) have 10 fields: user nice system idle iowait irq softirq steal guest guest_nice + ( $name, @load{qw(user nice system idle iowait irq softirq steal guest guest_nice)} ) = split ' ', $line; - # Not all kernels support this + # Not all kernels support these fields $load{steal} = 0 unless defined $load{steal}; $load{guest} = 0 unless defined $load{guest}; + $load{guest_nice} = 0 unless defined $load{guest_nice}; $load{TOTAL} = - sum( @load{qw(user nice system idle iowait irq softirq steal guest)} ); + sum( @load{qw(user nice system idle iowait irq softirq steal guest guest_nice)} ); return ( $name, \%load ); } diff --git a/lib/Loadbars/Utils.pm b/lib/Loadbars/Utils.pm index b4798f0..56b829d 100644 --- a/lib/Loadbars/Utils.pm +++ b/lib/Loadbars/Utils.pm @@ -25,7 +25,7 @@ our @EXPORT = qw ( sub say (@) { print "$_\n" for @_; return undef } sub newline () { say ''; return undef } sub debugsay (@) { say "Loadbars::DEBUG: $_" for @_; return undef } -sub sum (@) { my $sum = 0; $sum += $_ for @_; return $sum } +sub sum (@) { my $sum = 0; $sum += $_ // 0 for @_; return $sum } sub null ($) { defined $_[0] ? $_[0] : 0 } sub notnull ($) { $_[0] != 0 ? $_[0] : 1 } sub error ($) { die shift, "\n" } |
