You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sys.stderr.write("Made %i random slices to buffer reading a total of %f mb in %f s (%f mb/s)\n"% (max_num_accesses, num_bytes/mb, elapsed, (num_bytes/mb)/elapsed))
70
+
foraccess_modeinrange(2): # single, multi
71
+
num_accesses_left=max_num_accesses
72
+
num_bytes=0
73
+
fsize=fc.size
74
+
75
+
st=time()
76
+
buf.begin_access()
77
+
whilenum_accesses_left:
78
+
num_accesses_left-=1
79
+
ifaccess_mode: # multi
80
+
ofs_start=randint(0, fsize)
81
+
ofs_end=randint(ofs_start, fsize)
82
+
d=buf[ofs_start:ofs_end]
83
+
assertlen(d) ==ofs_end-ofs_start
84
+
assertd==data[ofs_start:ofs_end]
85
+
num_bytes+=len(d)
86
+
else:
87
+
pos=randint(0, fsize)
88
+
assertbuf[pos] ==data[pos]
89
+
num_bytes+=1
90
+
#END handle mode
91
+
# END handle num accesses
92
+
93
+
buf.end_access()
94
+
assertmanager.num_file_handles()
95
+
assertmanager.collect()
96
+
assertmanager.num_file_handles() ==0
97
+
elapsed=time() -st
98
+
mb=float(1000*1000)
99
+
mode_str= (access_modeand"slice") or"single byte"
100
+
sys.stderr.write("%s: Made %i random %s accesses to buffer reading a total of %f mb in %f s (%f mb/s)\n"% (man_id, max_num_accesses, mode_str, num_bytes/mb, elapsed, (num_bytes/mb)/elapsed))
0 commit comments