# HG changeset patch # User Heiko Schlittermann (JUMPER) # Date 1313485498 -7200 # Node ID f837948e43a469890225f5cf82b4ccf2b3916b6b # Parent 2d3d0e2e81e7b6d07a2eaf855f3df4e596956712# Parent 100c97dc02ca99749c8cf3d37f72d22813211992 [merged] diff -r 100c97dc02ca -r f837948e43a4 bin/imager.check --- a/bin/imager.check Wed Aug 03 10:41:51 2011 +0200 +++ b/bin/imager.check Tue Aug 16 11:04:58 2011 +0200 @@ -95,7 +95,7 @@ sub purge_unused { my ($dir, %block) = @_; - my ($total, $done); + my ($total, $done, $t0); verbose("# pass 1 - checking for unused blocks"); verbose("# estimating file count"); @@ -106,18 +106,20 @@ opendir(my $dh => $_); map { $total++ if not $_ ~~ [qw<. ..>] and length > 8 } readdir $dh; closedir($dh); + $File::Find::prune = $_ =~ /^[\d[a-f]{3}$/; # FIXME should be configurable }, "$dir/data" ); verbose("# got $total blocks/files"); # progress + $t0 = time; local $SIG{ALRM} = sub { return alarm 1 if not $done; - my $speed = $done / (time - $^T + 1); + my $speed = $done / (time - $t0 + 1); verbose sprintf "# pass 1 done %5.1f%% | %25s (%*d of %d blocks)", 100 * ($done / $total), - scalar(localtime($^T + $speed * ($total - $done))), + scalar(localtime $t0 + $total/$speed), length($total) => $done, $total; alarm 5; @@ -182,16 +184,17 @@ my $total = grep { $_ ne "" } keys(%block); my $done = 0; + my $t0 = time; verbose("# pass 2 - checking image completeness"); # progress local $SIG{ALRM} = sub { return alarm 1 if not $done; - my $speed = $done / (time - $^T + 1); + my $speed = $done / (time - $t0 + 1); verbose sprintf "# pass 2 done %5.1f%% | %25s (%*d of %d blocks)", 100 * $done / $total, - scalar(localtime($^T + ($total - $done) * $speed)), + scalar(localtime $t0 + $total/$speed), length($total) => $done, $total; alarm 5;