/[Frey]/trunk/lib/Frey/Shell/sar.pm
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/lib/Frey/Shell/sar.pm

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

revision 866 by dpavlin, Tue Dec 16 21:12:17 2008 UTC revision 867 by dpavlin, Tue Dec 16 22:35:05 2008 UTC
# Line 23  sub as_sponge { Line 23  sub as_sponge {
23          my $cmd = $self->sar_command . ' ' . $opts;          my $cmd = $self->sar_command . ' ' . $opts;
24          warn "# cmd: $cmd";          warn "# cmd: $cmd";
25    
26            my $date = '1970-01-01T';
27    
28          open(my $fh, '-|', $cmd) || die "can't open pipe to $cmd $!";          open(my $fh, '-|', $cmd) || die "can't open pipe to $cmd $!";
29          while(<$fh>) {          while(<$fh>) {
30                  chomp;                  chomp;
31                    if ( m{(\d\d)/(\d\d)/(\d\d\d\d)$} ) {
32                            $date = "$3-$1-$2T";
33                            warn "# date $date";
34                    }
35                  next unless m{^\d\d:\d\d:\d\d};                  next unless m{^\d\d:\d\d:\d\d};
36                  my @l = split(/\s+/,$_);                  my @l = split(/\s+/,$_);
37                  if ( $l[$#l] =~ m{_([^_]+)_} ) {                  if ( $l[$#l] =~ m{_([^_]+)_} ) {
# Line 36  sub as_sponge { Line 42  sub as_sponge {
42                          next;                          next;
43                  }                  }
44    
45                    $l[0] = $date . $l[0];
46    
47                  push @rows, [ @l ];                  push @rows, [ @l ];
48          }          }
49    

Legend:
Removed from v.866  
changed lines
  Added in v.867

  ViewVC Help
Powered by ViewVC 1.1.26