summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d01a8e3)
raw | patch | inline | side by side (parent: d01a8e3)
author | Nicolas Pitre <nico@fluxnic.net> | |
Wed, 14 Oct 2009 03:02:04 +0000 (23:02 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 14 Oct 2009 08:19:29 +0000 (01:19 -0700) |
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>
Signed-off-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
progress.c | patch | blob | history |
diff --git a/progress.c b/progress.c
index 132ed95a3d44d33ec0b8c887fbe05c0db11e37b1..3971f49f4ddaa774806bd1717379a1edd22ba17c 100644 (file)
--- a/progress.c
+++ b/progress.c
} 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);
}