Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/invoking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ the executable.
set server port to listen on/connect to to n (default 5201)

-f, --format
[kmgtKMGT] format to report: Kbits/Mbits/Gbits/Tbits
[kmgtKMGT] format to report: kmgt for kbit/Mbit/Gbit/Tbit or KMGT for KiB/MiB/GiB/TiB


-i, --interval n
pause n seconds between periodic throughput reports; default is
Expand Down
2 changes: 1 addition & 1 deletion src/iperf3.1
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ viewed by running iperf3 with the -h flag.
set server port to listen on/connect to to \fIn\fR (default 5201)
.TP
.BR -f ", " --format " "
[kmgtKMGT] format to report: Kbits/Mbits/Gbits/Tbits
[kmgtKMGT] format to report: kmgt for kbit/Mbit/Gbit/Tbit or KMGT for KiB/MiB/GiB/TiB
.TP
.BR -i ", " --interval " \fIn\fR"
pause \fIn\fR seconds between periodic throughput reports;
Expand Down
2 changes: 1 addition & 1 deletion src/iperf_locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const char usage_longstr[] = "Usage: iperf3 [-s|-c host] [options]\n"
" iperf3 [-h|--help] [-v|--version]\n\n"
"Server or Client:\n"
" -p, --port # server port to listen on/connect to\n"
" -f, --format [kmgtKMGT] format to report: Kbits, Mbits, Gbits, Tbits\n"
" -f, --format [kmgtKMGT] format to report: kmgt for kbit/Mbit/Gbit/Tbit or KMGT for KiB/MiB/GiB/TiB\n"
" -i, --interval # seconds between periodic throughput reports\n"
" -I, --pidfile file write PID file\n"
" -F, --file name xmit/recv the specified file\n"
Expand Down
12 changes: 6 additions & 6 deletions src/t_units.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,34 +74,34 @@ main(int argc, char **argv)
assert(llu == unit_atoi("3t"));

unit_snprintf(s, 11, 1024.0, 'A');
assert(strncmp(s, "1.00 KByte", 11) == 0);
assert(strncmp(s, "1.00 KiB", 11) == 0);

unit_snprintf(s, 11, 1024.0 * 1024.0, 'A');
assert(strncmp(s, "1.00 MByte", 11) == 0);
assert(strncmp(s, "1.00 MiB", 11) == 0);

unit_snprintf(s, 11, 1000.0, 'k');
assert(strncmp(s, "8.00 Kbit", 11) == 0);
assert(strncmp(s, "8.00 kbit", 11) == 0);

unit_snprintf(s, 11, 1000.0 * 1000.0, 'a');
assert(strncmp(s, "8.00 Mbit", 11) == 0);

d = 4.0 * 1024 * 1024 * 1024;
unit_snprintf(s, 11, d, 'A');
assert(strncmp(s, "4.00 GByte", 11) == 0);
assert(strncmp(s, "4.00 GiB", 11) == 0);

unit_snprintf(s, 11, d, 'a');
assert(strncmp(s, "34.4 Gbit", 11) == 0);

d = 4.0 * 1024 * 1024 * 1024 * 1024;
unit_snprintf(s, 11, d, 'A');
assert(strncmp(s, "4.00 TByte", 11) == 0);
assert(strncmp(s, "4.00 TiB", 11) == 0);

unit_snprintf(s, 11, d, 'a');
assert(strncmp(s, "35.2 Tbit", 11) == 0);

d = 4.0 * 1024 * 1024 * 1024 * 1024 * 1024;
unit_snprintf(s, 11, d, 'A');
assert(strncmp(s, "4096 TByte", 11) == 0);
assert(strncmp(s, "4096 TiB", 11) == 0);

unit_snprintf(s, 11, d, 'a');
assert(strncmp(s, "36029 Tbit", 11) == 0);
Expand Down
14 changes: 7 additions & 7 deletions src/units.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,17 @@ extern "C"
const char *label_byte[] =
{
"Byte",
"KByte",
"MByte",
"GByte",
"TByte"
"KiB",
"MiB",
"GiB",
"TiB"
};

/* labels for bit formats [kmgt] */
const char *label_bit[] =
{
"bit",
"Kbit",
"kbit",
"Mbit",
"Gbit",
"Tbit"
Expand All @@ -258,8 +258,8 @@ extern "C"
*
* Given a number in bytes and a format, converts the number and
* prints it out with a bits or bytes label.
* B, K, M, G, A for Byte, Kbyte, Mbyte, Gbyte, adaptive byte
* b, k, m, g, a for bit, Kbit, Mbit, Gbit, adaptive bit
* B, K, M, G, A for Byte, KiB, MiB, GiB, adaptive byte
* b, k, m, g, a for bit, kbit, Mbit , Gbit, adaptive bit
* adaptive picks the "best" one based on the number.
* s should be at least 11 chars long
* (4 digits + space + 5 chars max + null)
Expand Down