Skip to content

Commit 74c81e9

Browse files
made output more sensible
1 parent 44838e8 commit 74c81e9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

test-blockdevice.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ def gen_block(size, offset, seed2):
116116
read_error_count = 0
117117
write_error_count = 0
118118
data_total = 0
119+
failure_count = 0
119120

120121
lock = threading.Lock()
121122
ranges = []
@@ -132,12 +133,15 @@ def do(show_stats):
132133
global lock
133134
global ranges
134135
global data_total
136+
global failure_count
135137

136138
n_failed = 0
137139

138140
prev = start
139141

140142
while True:
143+
ok = True
144+
141145
lock.acquire()
142146
while True:
143147
# pick a number of blocks to work on
@@ -188,12 +192,14 @@ def do(show_stats):
188192
n_failed += 1
189193
if n_failed == 3:
190194
print('Stopped outputting errors for this thread')
195+
ok = False
191196
else:
192197
verified += 1
193198

194199
except OSError as e:
195200
print(f'Read error: {e} at {offset} ({len(b)} bytes)', offset/blocksize)
196201
read_error_count += 1
202+
ok = False
197203

198204
else:
199205
w += cur_n_blocks
@@ -224,17 +230,21 @@ def do(show_stats):
224230
except OSError as e:
225231
print(f'Write/trim error: {e} at {offset} ({len(b)} bytes)', offset/blocksize)
226232
write_error_count += 1
233+
ok = False
227234

228235
n += 1
229236
total_n += cur_n_blocks
230237

231238
data_total += cur_n_blocks * blocksize
232239

240+
if ok == False:
241+
failure_count += 1
242+
233243
if show_stats:
234244
now = time.time()
235245
time_diff = now - start
236246
if now - prev >= 1:
237-
print(f'total: {n}, n/s: {int(n / time_diff)}, avg blocks per it.: {total_n / n:.2f}, percent done: {w * 100 / n_blocks:.2f}, n verified: {verified}/{verified_d}/{verified_t}, write errors: {write_error_count}, MB/s: {data_total / time_diff / 1024 / 1024:.2f}')
247+
print(f'total: {n}, n/s: {int(n / time_diff)}, avg blocks per it.: {total_n / n:.2f}, percent done: {w * 100 / n_blocks:.2f}, verify cnt: {verified}/{verified_d}/{verified_t}, failures: {failure_count}, MB/s: {data_total / time_diff / 1024 / 1024:.2f}')
238248
prev = now
239249

240250
lock.acquire()

0 commit comments

Comments
 (0)