From 00ea574448aa60d9a0ed4eafb457b7eca75830f3 Mon Sep 17 00:00:00 2001 From: askiiart Date: Fri, 25 Oct 2024 16:29:05 -0500 Subject: [PATCH] fixed offset being way off --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e83acc8..abad0ba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,19 +33,21 @@ fn large_random_file_generation(path: String) { fn _large_random_file_generation_helper(i: &u64, out: Arc>>) { let mut rng = XorShiftRng::seed_from_u64(2484345508); - let block_size = 1310720; // NOTE: update this both here and in `large_random_file_generation()` let num_threads = 12; let mut data = [0u8; 1310720]; + let block_size = 1310720; // enter desired size in bytes, must be a multiple of 655360 // this is not a typo, the extra zero after 65536is for the threads // 26843545600 = 25 GiB let blocks_per_thread: u64 = 26843545600 / (block_size * num_threads); + println!("{}", i); for u in (i * blocks_per_thread)..((i + 1) * blocks_per_thread) { rng.fill_bytes(&mut data); - let offset: u64 = (i * blocks_per_thread * 1310720) + (1310720 * u); + //let offset: u64 = (i * blocks_per_thread * 1310720) + (1310720 * u); + let offset: u64 = u * block_size; let mut out = out.lock().unwrap(); out.as_mut().unwrap().write_all_at(&data, offset); }