Rewrte the speed reporting codepath
* include/wget/wget.h (wget_human_readable): Function is not a const * libwget/bar.c (_BAR_SETTINGS): Remove SPEED_REDRAW_TIME (struct _speed_report): Remove and add relevant fields to _bar_slot_t (_bar_update_speed): Removed (_bar_update_speed_stats): New function to populate the speed ring and fill in the speed_buf buffer (_bar_set_progress): Remove old commented out code (_bar_update_slot): Speed computation is moved to `_bar_update_speed_stats`. (wget_bar_set_slots): No longer need to realloc speed ring buffers (wget_bar_slot_begin): Initialize the ring_pos and the speed rings (wget_bar_deinit): Variable `speed_r` no longer used In this implementation, I've made a few functional changes and some other design changes to how the speed report is computed. First, I've removed the assumption that the progress bar is updated every 125ms. This is part of the client side logic and we can't assume that in the library. Instead, the speed report is computed every time the progress bar is refreshed. The size of the speed ring and how the computation is done is documented to allow the library users to make a decision on how they want to use the progress bar. While, I've currently removed SPEED_REDRAW_TIME, I do plan to bring it back soon. This will most likely be done alongside support for computing the ETA of the download. In this commit, I have also made it such that the speed is shown only after the speed ring is filled in entirely. This most likely needs to change such that we show the speed immediately. However, we document that it will jitter a lot while the speed ring is being populated.
Showing with 54 additions and 74 deletions
wget2 -hhelp still says:
--progress Type of progress bar (bar, dot, none). (default: none)
baris the only supported type. Not sure it is related to changes to this file. I'd like to old dot-progress as in Wget. How?