Skip to content

Commit

Permalink
bandwidth estimation fix
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertvanheusden committed Oct 24, 2024
1 parent 07e283c commit 2cc313e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test-blockdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ def do(show_stats):
else:
verified += 1

data_total += cur_n_blocks * blocksize

except OSError as e:
print(f'Read error: {e} at {offset} ({len(b)} bytes)', offset/blocksize)
failure_count += 1
Expand Down Expand Up @@ -225,16 +227,16 @@ def do(show_stats):
print(f'Write/trim error: {e} at {offset} ({len(b)} bytes)', offset/blocksize)
failure_count += 1

data_total += cur_n_blocks * blocksize

n += 1
total_n += cur_n_blocks

data_total += cur_n_blocks * blocksize

if show_stats:
now = time.time()
time_diff = now - start
if now - prev >= 1:
print(f'total: {n}, n/s: {int(n / time_diff)}, avg blocks per it.: {total_n / n:.2f}, percent done: {verified * 100 / n_blocks:.2f}, verify cnt: {verified}/{verified_d}/{verified_t}, failures: {failure_count}, MB/s: {data_total / time_diff / 1024 / 1024:.2f}')
print(f'total: {n}, n/s: {int(n / time_diff)}, avg blocks per it.: {total_n / n:.2f}, percent done: {verified * 100 / n_blocks:.2f}, verify cnt: {verified}/{verified_d}/{verified_t}, failures: {failure_count}, MB/s (r+w): {data_total / time_diff / 1024 / 1024:.2f}')
prev = now

lock.acquire()
Expand Down

0 comments on commit 2cc313e

Please sign in to comment.