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.
This commit is contained in:
Victor Stinner 2017-11-08 14:44:44 -08:00 committed by GitHub
parent 0e163d2ced
commit 8c663fd60e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 76 additions and 76 deletions

View file

@ -29,9 +29,9 @@ def text_open(fn, mode, encoding=None):
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 run_all_tests(options):
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, "