summaryrefslogtreecommitdiff
path: root/lib/Loadbars/Main.pm
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2012-06-26 23:27:49 +0200
committerPaul Buetow <paul@buetow.org>2012-06-26 23:27:49 +0200
commit3cb86d60de05cfa94790f5b822ba25b742c090a1 (patch)
tree5b6f3072f78a86ec1d49ceecdae62e6e80c2be00 /lib/Loadbars/Main.pm
parentcfc4f47dff63d62d0c2255f7c1416205986b6242 (diff)
add gbit link speed for netstats. add --netint param to specify the network interface
Diffstat (limited to 'lib/Loadbars/Main.pm')
-rw-r--r--lib/Loadbars/Main.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Loadbars/Main.pm b/lib/Loadbars/Main.pm
index cc30c82..df04c39 100644
--- a/lib/Loadbars/Main.pm
+++ b/lib/Loadbars/Main.pm
@@ -402,8 +402,7 @@ sub loop ($@) {
my %net_history;
- my $net_max_bytes = 0;
- my $net_max_packets = 0;
+ my $net_max_bytes = Loadbars::Constants->BYTES_GBIT;
my $sdl_redraw_background = 0;
my $sdl_font_height = 14;
@@ -745,7 +744,7 @@ sub loop ($@) {
if ( $C{shownet} && exists $NETSTATS_HAS{$host}) {
$add_x += $width + 1;
- my $int = 'wlan0';
+ my $int = $C{netint};
my $key = "$host;$int";
$net_history{$key} = [net_parse \$NETSTATS{$key}]
@@ -757,13 +756,15 @@ sub loop ($@) {
push @{$net_history{$key}}, $now_stat_r;
shift @{$net_history{$key}} while $C{netaverage} < @{$net_history{$key}};
- my $diff_stat_r = net_diff $now_stat_r->[0], $prev_stat_r->[0];
+ #my $diff_stat_r = net_diff $now_stat_r->[0], $prev_stat_r->[0];
- $net_max_bytes = $diff_stat_r->{b} if $diff_stat_r->{b} > $net_max_bytes;
- $net_max_bytes = $diff_stat_r->{tb} if $diff_stat_r->{tb} > $net_max_bytes;
+ #$net_max_bytes = $diff_stat_r->{b} if $diff_stat_r->{b} > $net_max_bytes;
+ #$net_max_bytes = $diff_stat_r->{tb} if $diff_stat_r->{tb} > $net_max_bytes;
my $net_per = percentage $net_max_bytes, $diff_stat_r->{b};
my $tnet_per = percentage $net_max_bytes, $diff_stat_r->{tb};
+ my $net_per = percentage $net_max_bytes, $diff_stat_r->{b};
+ my $tnet_per = percentage $net_max_bytes, $diff_stat_r->{tb};
#use Data::Dumper;
# print "$net_max_bytes $diff_stat_r->{b} $net_per ; $net_max_bytes $diff_stat_r->{tb} $tnet_per\n";