On 2010-03-21 Jonathan Nieder wrote: > Lasse Collin wrote: > > I thought it would be useful to see how long it had been working > > especially when it fails due to corrupt input when decompressing. > > I guess this is to know how long it would take to reproduce?
Yes. > 100.0 % 10,000,000 MiB / 10,000,000 MiB = 1.000 9999:50:50 > 9 h 40 min (elapsed time replaces compression speed on completion) I use the compression speed get an idea how fast the compression would be, so I don't want it to be removed when I press C-c. Speed is comparable between different files but estimated remaining time isn't. > 100.0 % 10,000 GiB / 10,000 GiB = 1.000 999 KiB/s 9 h 40 min > 9999:50:50 (less padding, more units) Maybe. The units have to be MiB when compressing, because otherwise the sizes won't get updated frequently enough to see that some progress is happening. They can be MiB also after successful operation, because then no extra space is needed for estimated remaining time. So the only situation where GiB or TiB would be used is after an error or user pressing C-c. > Speeds in progress displays can be ambiguous, anyway: they could > represent the average speed over the whole period, including long > stalls from e.g. suspending the process (as xz’s does) or they can be > a running average over a representative interval of recent time. Not handling SIGTSTP is a known bug. I don't know if I will fix it before 5.0.0. I suggest showing the estimated remaining time if the user has pressed C-c and in all other cases keep the current behavior. Would this be good enough solution? diff --git a/src/xz/message.c b/src/xz/message.c index 5dd9bc3..1ba67f5 100644 --- a/src/xz/message.c +++ b/src/xz/message.c @@ -666,7 +666,6 @@ progress_flush(bool finished) progress_active = false; const uint64_t elapsed = progress_elapsed(); - const char *elapsed_str = progress_time(elapsed); signals_block(); @@ -674,6 +673,16 @@ progress_flush(bool finished) // statistics are printed in the same format as the progress // indicator itself. if (progress_automatic) { + // If user interrupts the (de)compression, show the estimated + // remaining time instead of elapsed time if possible. Some + // users like to estimate the compression time of different + // settings by letting xz compress a file for a couple of + // seconds and then interrupting it. Leaving the estimated + // remaining time visible makes it easier. + const char *time_str = !finished && user_abort + ? progress_remaining(in_pos, elapsed) + : progress_time(elapsed); + // Using floating point conversion for the percentage instead // of static "100.0 %" string, because the decimal separator // isn't a dot in all locales. @@ -681,7 +690,7 @@ progress_flush(bool finished) progress_percentage(in_pos, finished), progress_sizes(compressed_pos, uncompressed_pos, true), progress_speed(uncompressed_pos, elapsed), - elapsed_str); + time_str); } else { // The filename is always printed. fprintf(stderr, "%s: ", filename); @@ -702,6 +711,7 @@ progress_flush(bool finished) if (speed[0] != '\0') fprintf(stderr, ", %s", speed); + const char *elapsed_str = progress_time(elapsed); if (elapsed_str[0] != '\0') fprintf(stderr, ", %s", elapsed_str); -- Lasse Collin | IRC: Larhzu @ IRCnet & Freenode -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org