From: Alan J. Pippin Date: Mon, 3 Mar 2008 15:09:49 +0000 (-0700) Subject: Added total data count for each date X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/images/checkmark.gif?a=commitdiff_plain;h=71ce0ed663bad1daec6a3471c188a110c271235a;p=zfs-nexenta%2F.git Added total data count for each date --- diff --git a/zfs-log-parser b/zfs-log-parser index d43e650..26b0589 100755 --- a/zfs-log-parser +++ b/zfs-log-parser @@ -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); } #########