X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=progress.c;h=3971f49f4ddaa774806bd1717379a1edd22ba17c;hb=28368e9f0bced688e4baf3b02b1bfcb6580909c4;hp=132ed95a3d44d33ec0b8c887fbe05c0db11e37b1;hpb=6ff9ae9f97101c30897332f608f35ad232b1faf2;p=git.git diff --git a/progress.c b/progress.c index 132ed95a3..3971f49f4 100644 --- a/progress.c +++ b/progress.c @@ -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); }