New option "--stats", to show a line of statistics about the transfer once it has ended (issue #49).

This commit is contained in:
Andrew Wood
2024-10-04 15:12:22 +01:00
parent fe4cc4b01d
commit 9bd5a518ea
19 changed files with 473 additions and 264 deletions
+6
View File
@@ -73,6 +73,9 @@
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have the <math.h> header file. */
#undef HAVE_MATH_H
/* Define to 1 if you have the `memcpy' function. */
#undef HAVE_MEMCPY
@@ -112,6 +115,9 @@
/* Define to 1 if you have the `splice' function. */
#undef HAVE_SPLICE
/* Define to 1 if you have the `sqrtl' function. */
#undef HAVE_SQRTL
/* Define to 1 if stdbool.h conforms to C99. */
#undef HAVE_STDBOOL_H
+1
View File
@@ -74,6 +74,7 @@ struct opts_s {
bool sync_after_write; /* set if we sync after every write */
bool direct_io; /* set if O_DIRECT is to be used */
bool discard_input; /* set to write nothing to output */
bool show_stats; /* set to write statistics at the end */
bool width_set_manually; /* width was set manually, not detected */
bool height_set_manually; /* height was set manually, not detected */
};
+7
View File
@@ -134,6 +134,7 @@ struct pvstate_s {
bool direct_io_changed; /* set when direct_io is changed */
bool no_splice; /* never use splice() */
bool discard_input; /* write nothing to stdout */
bool show_stats; /* show statistics on exit */
bool width_set_manually; /* width was set manually, not detected */
bool height_set_manually; /* height was set manually, not detected */
} control;
@@ -219,6 +220,12 @@ struct pvstate_s {
long double prev_trans; /* amount transferred since last rate calculation */
long double current_avg_rate; /* current average rate over last history intervals */
long double rate_min; /* minimum measured transfer rate */
long double rate_max; /* maximum measured transfer rate */
long double rate_sum; /* sum of all measured transfer rates */
long double ratesquared_sum; /* sum of the squares of each transfer rate */
unsigned long measurements_taken; /* how many times the rate was measured */
/* Keep track of progress over last intervals to compute current average rate. */
/*@null@*/ struct { /* state at previous intervals (circular buffer) */
long double elapsed_sec; /* time since start of transfer */
+1
View File
@@ -172,6 +172,7 @@ extern void pv_state_set_format(pvstate_t state, bool progress,
*/
extern void pv_state_force_set(pvstate_t, bool);
extern void pv_state_cursor_set(pvstate_t, bool);
extern void pv_state_show_stats_set(pvstate_t, bool);
extern void pv_state_numeric_set(pvstate_t, bool);
extern void pv_state_wait_set(pvstate_t, bool);
extern void pv_state_delay_start_set(pvstate_t, double);