Added -m, --eta-window option: set time window for average rate computation (default 30s)
This commit is contained in:
@@ -40,6 +40,8 @@ void display_help(void)
|
||||
N_("show data transfer rate counter")},
|
||||
{"-a", "--average-rate", 0,
|
||||
N_("show data transfer average rate counter")},
|
||||
{"-m", "--eta-window", N_("SEC"),
|
||||
N_("compute current average rate over a SEC seconds window for ETA (default 30s)")},
|
||||
{"-b", "--bytes", 0,
|
||||
N_("show number of bytes transferred")},
|
||||
{"-T", "--buffer-percent", 0,
|
||||
|
||||
@@ -206,6 +206,7 @@ int main(int argc, char **argv)
|
||||
pv_state_format_string_set(state, opts->format);
|
||||
pv_state_watch_pid_set(state, opts->watch_pid);
|
||||
pv_state_watch_fd_set(state, opts->watch_fd);
|
||||
pv_state_eta_window_set(state, opts->eta_window);
|
||||
|
||||
pv_state_set_format(state, opts->progress, opts->timer, opts->eta,
|
||||
opts->fineta, opts->rate, opts->average_rate,
|
||||
|
||||
+7
-1
@@ -80,12 +80,13 @@ opts_t opts_parse(int argc, char **argv)
|
||||
{"remote", 1, NULL, (int) 'R'},
|
||||
{"pidfile", 1, NULL, (int) 'P'},
|
||||
{"watchfd", 1, NULL, (int) 'd'},
|
||||
{"eta-window", 1, NULL, (int) 'm'},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
int option_index = 0;
|
||||
#endif
|
||||
char *short_options =
|
||||
"hVpteIrabTA:fnqcWD:s:l0i:w:H:N:F:L:B:CESR:P:d:";
|
||||
"hVpteIrabTA:fnqcWD:s:l0i:w:H:N:F:L:B:CESR:P:d:m:";
|
||||
int c, numopts;
|
||||
unsigned int check_pid;
|
||||
int check_fd;
|
||||
@@ -121,6 +122,7 @@ opts_t opts_parse(int argc, char **argv)
|
||||
opts->delay_start = 0;
|
||||
opts->watch_pid = 0;
|
||||
opts->watch_fd = -1;
|
||||
opts->eta_window = 30;
|
||||
|
||||
do {
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
@@ -144,6 +146,7 @@ opts_t opts_parse(int argc, char **argv)
|
||||
case 'L':
|
||||
case 'B':
|
||||
case 'R':
|
||||
case 'm':
|
||||
if (pv_getnum_check(optarg, PV_NUMTYPE_INTEGER) !=
|
||||
0) {
|
||||
fprintf(stderr, "%s: -%c: %s\n",
|
||||
@@ -310,6 +313,9 @@ opts_t opts_parse(int argc, char **argv)
|
||||
(void) sscanf(optarg, "%u:%d", &(opts->watch_pid),
|
||||
&(opts->watch_fd));
|
||||
break;
|
||||
case 'm':
|
||||
opts->eta_window = pv_getnum_ui(optarg);
|
||||
break;
|
||||
default:
|
||||
#ifdef HAVE_GETOPT_LONG
|
||||
fprintf(stderr,
|
||||
|
||||
Reference in New Issue
Block a user