Project

General

Profile

Actions

Feature #14190

closed

dd could include a human byte size

Added by Robert Mustacchi 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Category:
cmd - userland programs
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

While working on #14189 I took a look at how we were outputting statistics compared to other systems. When #10182 introduced scaling, it used base 2 values here. This makes sense and is what we generally want; however, while researching what others do in #14189 I found that they actually use base 10 powers. While there's a lot to say on the disagreement between the binary and base 10 prefixes, at this point we should be helpful and be consistent about what we use and switch to the 'official' prefixes that indicate powers of two rather than just leaving folks to guess as much as it may not be great.

The main impetus for doing this is to actually add a humanized version of the bytes transferred in the dd output. While the line 111171076096 bytes transferred in 2.482440 secs (41.7GB/sec) is useful, we can take a leaf out of the book from other dd implementations and in fact #10182 and add something similar for the total bytes transferred as well. In addition, the old format used to include a space between the unit for the throughput. We should restore this while here to make it a bit easier to read (which also matches other implementations). This now leaves the summary line looking like:

$ ./dd bs=1M if=/dev/zero of=/dev/null
^C119258+0 records in
119258+0 records out
125051076608 (116 GiB) bytes transferred in 2.843474 secs (41 GiB/sec)
Actions

Also available in: Atom PDF