unsigned delay;
unsigned delayed_percent_treshold;
struct throughput *throughput;
+ uint64_t start_ns;
};
static volatile sig_atomic_t progress_update;
progress->delayed_percent_treshold = percent_treshold;
progress->delay = delay;
progress->throughput = NULL;
+ progress->start_ns = getnanotime();
set_progress_signal();
return progress;
}
struct throughput *tp = progress->throughput;
if (tp) {
- unsigned int rate = !tp->avg_misecs ? 0 :
- tp->avg_bytes / tp->avg_misecs;
+ uint64_t now_ns = getnanotime();
+ 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);
}
progress_update = 1;