parallel: Small fix for ETA.

This commit is contained in:
Ole Tange 2011-04-10 18:01:58 +02:00
parent 1478df33f7
commit 97d1e025dc
2 changed files with 15 additions and 7 deletions

View file

@ -165,6 +165,8 @@ New in this release:
? Part of Debian?
? Part of Ubuntu?
* Thanks to Ævar Arnfjörð Bjarmason for reading my code.
* GNU Parallel was presented at:
- LUGA, Augsburg, 2011-03-26, http://www.luga.de/Aktionen/LIT-2011/Programm
- OSAA.dk, Aarhus, 2011-04-12

View file

@ -1013,7 +1013,16 @@ sub progress {
# Smooth the eta so it does not jump wildly
$Private::smoothed_avg_time = (1 - $pctcomplete) *
$Private::smoothed_avg_time + $pctcomplete * $avgtime;
my $this_eta = $left * $Private::smoothed_avg_time;
my $this_eta;
$Private::last_time ||= $timepassed;
if($timepassed != $Private::last_time
or not defined $Private::last_eta) {
$Private::last_time = $timepassed;
$this_eta = $left * $Private::smoothed_avg_time;
$Private::last_eta = $this_eta;
} else {
$this_eta = $Private::last_eta;
}
$eta = sprintf("ETA: %ds %dleft %.2favg ", $this_eta, $left, $avgtime);
}
}
@ -1635,9 +1644,6 @@ sub my_size {
}
}
# Guvf vf n grfg gb frr vs bguref ner ernqvat zl pbqr. Cyrnfr rznvy
# pbbxvr@gnatr.qx jura lbh ernq guvf
sub my_dump {
# Returns:
# ascii expression of object if Data::Dump(er) is installed