/[scripts]/trunk/dwm-status.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/dwm-status.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 35 by dpavlin, Sun May 27 09:14:14 2007 UTC revision 38 by dpavlin, Tue May 29 11:44:46 2007 UTC
# Line 29  sub proc2hash { Line 29  sub proc2hash {
29                  $value =~ s/ m[VW]h*$//;                  $value =~ s/ m[VW]h*$//;
30                  $h->{$key} = $value;                  $h->{$key} = $value;
31          }          }
32          warn dump( $h ) if ( $debug );          warn "$f ",dump( $h ) if ( $debug );
33          return $h;          return $h;
34  }  }
35    
# Line 74  while ( 1 ) { Line 74  while ( 1 ) {
74                          my $pcnt = $state->{'remaining capacity'} / $info->{'design capacity'};                          my $pcnt = $state->{'remaining capacity'} / $info->{'design capacity'};
75    
76                          my $time = $state->{'remaining capacity'} / ( $state->{'present rate'} );                          my $time = $state->{'remaining capacity'} / ( $state->{'present rate'} );
77                            $time = ( $info->{'design capacity'} - $state->{'remaining capacity'} ) / $state->{'present rate'} if ( $state->{'charging state'} eq 'charging' );
78    
79                          warn "time = $time\n" if ($debug);                          warn "time = $time\n" if ($debug);
80    
# Line 108  while ( 1 ) { Line 109  while ( 1 ) {
109    
110          foreach ( split(/\n/, $net) ) {          foreach ( split(/\n/, $net) ) {
111                  s/^\s+//;                  s/^\s+//;
112                    s/:\s+/:/;
113                  my @n = split(/\s+/, $_, 17);                  my @n = split(/\s+/, $_, 17);
114                  next unless ( $n[0] =~ m!(eth\d|ath\d):! );                  next unless ( $n[0] =~ s!(eth\d|ath\d):!! );
115    
116                  warn dump( @n ) if ($debug);                  warn dump( @n ) if ($debug);
117                  $rx += $n[1];                  $rx += $n[0];
118                  $tx += $n[9];                  $tx += $n[8];
119          }          }
120          warn "rx: $rx tx: $tx\n" if ($debug);          warn "rx: $rx tx: $tx\n" if ($debug);
121    

Legend:
Removed from v.35  
changed lines
  Added in v.38

  ViewVC Help
Powered by ViewVC 1.1.26