Merge branch 'rs/progress-overall-throughput-at-the-end' into maint
The progress meter did not give a useful output when we haven't had 0.5 seconds to measure the throughput during the interval. Instead show the overall throughput rate at the end, which is a much more useful number. * rs/progress-overall-throughput-at-the-end: progress: show overall rate in last update
This commit is contained in:
commit
4f77f618d9
@ -36,6 +36,7 @@ struct progress {
|
|||||||
unsigned delay;
|
unsigned delay;
|
||||||
unsigned delayed_percent_treshold;
|
unsigned delayed_percent_treshold;
|
||||||
struct throughput *throughput;
|
struct throughput *throughput;
|
||||||
|
uint64_t start_ns;
|
||||||
};
|
};
|
||||||
|
|
||||||
static volatile sig_atomic_t progress_update;
|
static volatile sig_atomic_t progress_update;
|
||||||
@ -221,6 +222,7 @@ struct progress *start_progress_delay(const char *title, unsigned total,
|
|||||||
progress->delayed_percent_treshold = percent_treshold;
|
progress->delayed_percent_treshold = percent_treshold;
|
||||||
progress->delay = delay;
|
progress->delay = delay;
|
||||||
progress->throughput = NULL;
|
progress->throughput = NULL;
|
||||||
|
progress->start_ns = getnanotime();
|
||||||
set_progress_signal();
|
set_progress_signal();
|
||||||
return progress;
|
return progress;
|
||||||
}
|
}
|
||||||
@ -247,8 +249,10 @@ void stop_progress_msg(struct progress **p_progress, const char *msg)
|
|||||||
struct throughput *tp = progress->throughput;
|
struct throughput *tp = progress->throughput;
|
||||||
|
|
||||||
if (tp) {
|
if (tp) {
|
||||||
unsigned int rate = !tp->avg_misecs ? 0 :
|
uint64_t now_ns = getnanotime();
|
||||||
tp->avg_bytes / tp->avg_misecs;
|
unsigned int misecs, rate;
|
||||||
|
misecs = ((now_ns - progress->start_ns) * 4398) >> 32;
|
||||||
|
rate = tp->curr_total / (misecs ? misecs : 1);
|
||||||
throughput_string(&tp->display, tp->curr_total, rate);
|
throughput_string(&tp->display, tp->curr_total, rate);
|
||||||
}
|
}
|
||||||
progress_update = 1;
|
progress_update = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user