Skip to content

Commit

Permalink
change throughput display units with fast links
Browse files Browse the repository at this point in the history
Switch to MiB/s when the connection is fast enough (i.e. on a LAN).

Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
npitre authored and gitster committed Oct 14, 2009
1 parent d01a8e3 commit 583371a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion progress.c
Expand Up @@ -131,7 +131,13 @@ static void throughput_string(struct throughput *tp, off_t total,
} else {
l -= snprintf(tp->display, l, ", %u bytes", (int)total);
}
if (rate)

if (rate > 1 << 10) {
int x = rate + 5; /* for rounding */
snprintf(tp->display + sizeof(tp->display) - l, l,
" | %u.%2.2u MiB/s",
x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
} else if (rate)
snprintf(tp->display + sizeof(tp->display) - l, l,
" | %u KiB/s", rate);
}
Expand Down

0 comments on commit 583371a

Please sign in to comment.