Skip to content

Commit

Permalink
add reverse read model
Browse files Browse the repository at this point in the history
  • Loading branch information
lquenti committed Feb 27, 2024
1 parent 5b42225 commit 399f7dd
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions blackheap/src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ const ACCESS_SIZES: [u32; 24] = [
pub enum BenchmarkScenario {
RandomUncached,
SameOffset,
Reverse,
}

impl ToString for BenchmarkScenario {
fn to_string(&self) -> String {
match self {
BenchmarkScenario::SameOffset => "SameOffset".to_string(),
BenchmarkScenario::RandomUncached => "RandomUncached".to_string(),
BenchmarkScenario::Reverse => "Reverse".to_string(),
}
}
}
Expand All @@ -43,11 +45,46 @@ impl Benchmark {
vec![
Self::new_random_uncached_read(file_path, root),
Self::new_random_uncached_write(file_path, root),
Self::new_reverse_read(file_path, root),
Self::new_reverse_write(file_path, root),
Self::new_same_offset_read(file_path),
Self::new_same_offset_write(file_path),
]
}

pub fn new_reverse_read(file_path: &str, root: bool) -> Self {
Benchmark {
scenario: BenchmarkScenario::RandomUncached,
config: BenchmarkConfig {
filepath: file_path.to_string(),
memory_buffer_in_bytes: 4 * 1024 * 1024 * 1024,
file_size_in_bytes: 25 * 1024 * 1024 * 1024,
access_size_in_bytes: 4 * 1024, /* any random value */
number_of_io_op_tests: 1000,
access_pattern_in_memory: AccessPattern::Reverse,
access_pattern_in_file: AccessPattern::Reverse,
is_read_operation: true,
prepare_file_size: true,
drop_cache_first: root,
do_reread: false,
restrict_free_ram_to: None,
},
results: HashMap::new(),
}
}

pub fn new_reverse_write(file_path: &str, root: bool) -> Self {
Benchmark {
scenario: BenchmarkScenario::RandomUncached,
config: {
let mut config = Self::new_reverse_read(file_path, root).config;
config.is_read_operation = false;
config
},
results: HashMap::new(),
}
}

pub fn new_random_uncached_read(file_path: &str, root: bool) -> Self {
Benchmark {
scenario: BenchmarkScenario::RandomUncached,
Expand Down

0 comments on commit 399f7dd

Please sign in to comment.