This adds the ability for the progress code to also display transfer
throughput when that makes sense.
The math was inspired by commit c548cf4ee0
from Linus.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Nicolas Pitre18 years agocommitted byJunio C Hamano
static int display(struct progress *progress, unsigned n, int done)
{
char *eol;
char *eol, *tp;
if (progress->delay) {
if (!progress_update || --progress->delay)
@ -64,18 +78,20 @@ static int display(struct progress *progress, unsigned n, int done)
@@ -64,18 +78,20 @@ static int display(struct progress *progress, unsigned n, int done)
fprintf(stderr, "%s: %u%s", progress->title, n, eol);
fprintf(stderr, "%s: %u%s%s", progress->title, n, tp, eol);
progress_update = 0;
return 1;
}
@ -83,6 +99,60 @@ static int display(struct progress *progress, unsigned n, int done)
@@ -83,6 +99,60 @@ static int display(struct progress *progress, unsigned n, int done)
return 0;
}
void display_throughput(struct progress *progress, unsigned long n)