ckolivas / lrzip

Long Range Zip
http://lrzip.kolivas.org
GNU General Public License v2.0
618 stars 76 forks source link

BUG (minor): ETA computation never shown #132

Closed pete4abw closed 4 years ago

pete4abw commented 5 years ago

Way back in version 0.24, ETA computation was introduced which would print estimated time remaining after one chunk was compressed. Pass 2 / 7 -- Elapsed Time: 00:00:32. ETA: 00:03:10. Compress Speed: 31.250MB/s. With the introduction of the STDIN piping, a small change was made to the code which made this feature stop printing. The pct_base variable was used to compute what percent of compression has been completed compared to the size of the file being compressed. Commit 9756dd3 accidentally changed the test effectively disabling this feature. Changing rzip.c as below will re-enable this feature for those interested.

diff --git a/rzip.c b/rzip.c
index 25d134b..15f5fa7 100644
--- a/rzip.c
+++ b/rzip.c
@@ -1124,7 +1124,7 @@ retry:

                gettimeofday(&current, NULL);
                /* this will count only when size > window */
-               if (last.tv_sec > 0 && pct_base > 100) {
+               if (last.tv_sec > 0 && pct_base > 0) {
                        unsigned int eta_hours, eta_minutes, eta_seconds, elapsed_time, finish_time,
                                elapsed_hours, elapsed_minutes, elapsed_seconds, diff_seconds;

As a result, and as chunk size increase with newer systems, I'm reworking the logic so that in cases of large chunks, the ETA estimates will print more frequently during the hash_search function, not in rzip_fd. I'm not making a pull request on this since no one seemed to have noticed and I'm going to change the logic anyway.

pete4abw commented 4 years ago

see #144