(
mut file: &File,
iterations: usize,
write_size: usize,
file_size: u64,
)
| 35 | } |
| 36 | |
| 37 | fn write_random_bytes( |
| 38 | mut file: &File, |
| 39 | iterations: usize, |
| 40 | write_size: usize, |
| 41 | file_size: u64, |
| 42 | ) -> std::io::Result<()> { |
| 43 | let mut rng = rand::thread_rng(); |
| 44 | let buffer: Vec<u8> = (0..write_size).map(|_| rng.gen()).collect(); |
| 45 | |
| 46 | for _ in 0..iterations { |
| 47 | let position = rng.gen_range(0..file_size); |
| 48 | file.seek(SeekFrom::Start(position))?; |
| 49 | file.write_all(&buffer)?; |
| 50 | } |
| 51 | |
| 52 | Ok(()) |
| 53 | } |
| 54 | |
| 55 | fn benchmark_concurrent_writes(c: &mut Criterion) { |
| 56 | let file_size = 10 * 1024 * 1024; // 10 MB |
no outgoing calls
no test coverage detected