fixed offset being way off

This commit is contained in:
askiiart 2024-10-25 16:29:31 -05:00
parent 1573de227c
commit 42fbe81ecb
Signed by untrusted user who does not match committer: askiiart
GPG key ID: EA85979611654C30

View file

@ -33,25 +33,26 @@ fn large_random_file_generation(path: String) {
fn _large_random_file_generation_helper(i: &u64, out: Arc<Mutex<Result<File, Error>>>) {
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);
}
}
fn single_threaded_large_random_file_generation(path: String) {
let mut out = File::create(path).unwrap();
let mut rng = XorShiftRng::seed_from_u64(2484345508);
@ -62,7 +63,6 @@ fn single_threaded_large_random_file_generation(path: String) {
}
}
fn small_random_files_generation(folder: String) {
let mut rng = XorShiftRng::seed_from_u64(2484345508);
let mut data = [0u8; 1024];
@ -88,13 +88,16 @@ fn grab_kernel(folder: String) {
}
// i'm too lazy to do this in rust
println!("{:?}", Command::new("tar")
println!(
"{:?}",
Command::new("tar")
.arg("-xvf")
.arg("data/kernel/kernel.tar.xz")
.arg("--one-top-level")
.current_dir("data/kernel/")
.output()
.unwrap());
.unwrap()
);
}
fn main() {