Replace KB unit with KiB (#4293)
kB (*kilo* byte) unit means 1000 bytes, whereas KiB ("kibibyte")
means 1024 bytes. KB was misused: replace kB or KB with KiB when
appropriate.
Same change for MB and GB which become MiB and GiB.
Change the output of Tools/iobench/iobench.py.
Round also the size of the documentation from 5.5 MB to 5 MiB.
diff --git a/Tools/iobench/iobench.py b/Tools/iobench/iobench.py
index 712e584..b0a7feb 100644
--- a/Tools/iobench/iobench.py
+++ b/Tools/iobench/iobench.py
@@ -29,9 +29,9 @@
return open(fn, mode)
def get_file_sizes():
- for s in ['20 KB', '400 KB', '10 MB']:
+ for s in ['20 KiB', '400 KiB', '10 MiB']:
size, unit = s.split()
- size = int(size) * {'KB': 1024, 'MB': 1024 ** 2}[unit]
+ size = int(size) * {'KiB': 1024, 'MiB': 1024 ** 2}[unit]
yield s.replace(' ', ''), size
def get_binary_files():
@@ -273,7 +273,7 @@
def print_results(size, n, real, cpu):
bw = n * float(size) / 1024 ** 2 / real
- bw = ("%4d MB/s" if bw > 100 else "%.3g MB/s") % bw
+ bw = ("%4d MiB/s" if bw > 100 else "%.3g MiB/s") % bw
out.write(bw.rjust(12) + "\n")
if cpu < 0.90 * real:
out.write(" warning: test above used only %d%% CPU, "