Skip to content

Commit 583371a

Browse files
npitregitster
authored andcommitted
change throughput display units with fast links
Switch to MiB/s when the connection is fast enough (i.e. on a LAN). Signed-off-by: Nicolas Pitre <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d01a8e3 commit 583371a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

progress.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,13 @@ static void throughput_string(struct throughput *tp, off_t total,
131131
} else {
132132
l -= snprintf(tp->display, l, ", %u bytes", (int)total);
133133
}
134-
if (rate)
134+
135+
if (rate > 1 << 10) {
136+
int x = rate + 5; /* for rounding */
137+
snprintf(tp->display + sizeof(tp->display) - l, l,
138+
" | %u.%2.2u MiB/s",
139+
x >> 10, ((x & ((1 << 10) - 1)) * 100) >> 10);
140+
} else if (rate)
135141
snprintf(tp->display + sizeof(tp->display) - l, l,
136142
" | %u KiB/s", rate);
137143
}

0 commit comments

Comments
 (0)