using global rate gives wildly inacurrate ETAs if rate changes over time.
this makes pv keep a history of progress over the last 30s interval and compute
current average rate over that, which fixes the issue.
fixed -a, --average-rate: show current average rate instead of global rate
[ quick test ]
- in one shell:
$ dd if=/dev/zero of=/tmp/foo bs=1M count=5 # simulate fast initial rate,
$ (while true; do ls /*; sleep 1; done) >> /tmp/foo # then slow rate. leave running ...
- in another shell:
$ tail -f -n +1 /tmp/foo | pv -s 800M > /dev/null
5.62MiB 0:00:17 [33.1KiB/s] [> ] 0% ETA 0:40:02
bad: (pv 1.6.6 - 1.6.20)
ETA of a few minutes that keeps increasing ever and ever ...
5.62MiB 0:00:16 [33.1KiB/s] [> ] 0% ETA 6:45:53
good:
ETA of 6+ hours, which is how long it'll take to reach 800Mb at 33k/s