mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 05:57:54 +00:00
parallel: Small fix for ETA.
This commit is contained in:
parent
1478df33f7
commit
97d1e025dc
|
@ -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
|
||||
|
|
20
src/parallel
20
src/parallel
|
@ -1008,13 +1008,22 @@ sub progress {
|
|||
my $left = $total - $completed;
|
||||
my $pctcomplete = $completed / $total;
|
||||
my $timepassed = (time - $Private::first_completed);
|
||||
my $avgtime = $timepassed / $completed;
|
||||
my $avgtime = $timepassed / $completed;
|
||||
$Private::smoothed_avg_time ||= $avgtime;
|
||||
# Smooth the eta so it does not jump wildly
|
||||
# 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;
|
||||
$eta = sprintf("ETA: %ds %dleft %.2favg ", $this_eta, $left, $avgtime);
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue