def benchmark_creads(mem, reconstructed, legend): img = img_utils.ImageUtils(reconstructed, first_dim, second_dim, third_dim, np.uint16) s_time = time() total_read_time, total_write_time, total_seek_time, total_seek_number = img.reconstruct_img( legend, "clustered", mem, input_compressed=True, benchmark=True) total_time = time() - s_time print total_read_time, total_write_time, total_seek_time, total_seek_number, total_time return (total_read_time, total_write_time, total_seek_time, total_seek_number, total_time)
def benchmark_creads(mem, reconstructed, legend): img = img_utils.ImageUtils(reconstructed, first_dim, second_dim, third_dim, np.uint16) s_time = time() total_read_time, total_write_time, total_seek_time, total_seek_number = img.reconstruct_img( legend, "clustered", mem, input_compressed=True, benchmark=True) e_time = time() print "before compressing takes ", e_time - s_time print "offline compressing..." os.system("gzip {}".format(reconstructed)) compressed_e_time = time() compressing_time = compressed_e_time - e_time print "compressing_time", compressing_time total_time = compressed_e_time - s_time print total_read_time, total_write_time, total_seek_time, total_seek_number, compressing_time, total_time return (total_read_time, total_write_time, total_seek_time, total_seek_number, compressing_time, total_time)
def benchmark_mwrites(mem, ori_image, out_dir): img = img_utils.ImageUtils(ori_image) s_time = time() total_read_time, total_write_time, total_seek_time, total_seek_number = img.split_multiple_writes( Y_splits, Z_splits, X_splits, out_dir, mem, filename_prefix="bigbrain", extension="nii", benchmark=True) total_time = time() - s_time print "mem = {}, takes {}".format(mem, total_time) return (total_read_time, total_write_time, total_seek_time, total_seek_number, total_time)