Added total data count for each date
authorAlan J. Pippin <ajp@pippins.net>
Mon, 3 Mar 2008 15:09:49 +0000 (08:09 -0700)
committerAlan J. Pippin <ajp@pippins.net>
Mon, 3 Mar 2008 15:09:49 +0000 (08:09 -0700)
zfs-log-parser

index d43e650e1d64d328d17e7f8ee407ec43662ed978..26b05892f2bfd6be386751e5dd7456d666ee6c0a 100755 (executable)
@@ -100,8 +100,8 @@ sub parse_snapshot_totals_logfile {
            $month = $month2num{$month};
            if($daynum < 10) { $daynum = "0".$daynum; }
            $date="$month-$daynum-$year";
-           if(!defined $dates{$date}) { $header .= $date . " "; }
-           $dates{$date} = 1;
+           if(!defined $founddates{$date}) { $header .= $date . " "; }
+           $founddates{$date} = 1;
        }
        if(($in_totals == 1) && ($line =~ /^\s+$/)) {
            $in_totals = 0;
@@ -129,15 +129,21 @@ sub parse_snapshot_totals_logfile {
            if($date !~ /(\d+)-(\d+)-(\d+)/) { next; }
            $date_data=adjust_data($totals{$filesystem}{$date}{data});
            $data .= sprintf("%10s",$date_data). " ";
+           $date_totals{$date}{data} += $totals{$filesystem}{$date}{data};
        }
        $data_total=adjust_data($data_total);
        $total_delta+=$totals{$filesystem}{delta};
        $delta=adjust_data($totals{$filesystem}{delta});
        printf("%-${maxlen}s %s %10s\n",$filesystem,$data,$delta);
     }
+    $data="";
     $data_len=length($data);
     $total_delta=adjust_data($total_delta);
-    printf("%-${maxlen}s %-${data_len}s %10s\n","Totals:","",$total_delta);
+    foreach $date (sort keys %date_totals) {
+       $date_data=adjust_data($date_totals{$date}{data});
+       $data .= sprintf("%10s",$date_data). " ";
+    }
+    printf("%-${maxlen}s %-${data_len}s %10s\n","Totals:",$data,$total_delta);
 }
 
 #########