From d74beda0913a514a2bc6af2b4d1824a5cd7614fc Mon Sep 17 00:00:00 2001 From: Lars Quentin Date: Mon, 26 Feb 2024 12:18:03 +0100 Subject: [PATCH] handle new access pattern in Rust code --- .gitignore | 3 +++ blackheap-benchmarker/src/c_code/benchmarker.rs | 2 ++ blackheap-benchmarker/src/lib.rs | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/.gitignore b/.gitignore index 2ee01cd..4714898 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# debug files +results_debug/ + # Generated by Cargo # will have compiled files and executables debug/ diff --git a/blackheap-benchmarker/src/c_code/benchmarker.rs b/blackheap-benchmarker/src/c_code/benchmarker.rs index 4596efa..dae6691 100644 --- a/blackheap-benchmarker/src/c_code/benchmarker.rs +++ b/blackheap-benchmarker/src/c_code/benchmarker.rs @@ -52,6 +52,7 @@ fn bindgen_test_layout_max_align_t() { pub const access_pattern_ACCESS_PATTERN_CONST: access_pattern = 0; pub const access_pattern_ACCESS_PATTERN_SEQUENTIAL: access_pattern = 1; pub const access_pattern_ACCESS_PATTERN_RANDOM: access_pattern = 2; +pub const access_pattern_ACCESS_PATTERN_REVERSE: access_pattern = 3; pub type access_pattern = ::std::os::raw::c_uint; pub const error_codes_ERROR_CODES_SUCCESS: error_codes = 0; pub const error_codes_ERROR_CODES_MALLOC_FAILED: error_codes = 1; @@ -66,6 +67,7 @@ pub const error_codes_ERROR_CODES_REMOVE_FAILED: error_codes = 9; pub const error_codes_ERROR_CODES_DROP_PAGE_CACHE_FAILED_NO_PERMISSIONS: error_codes = 10; pub const error_codes_ERROR_CODES_DROP_PAGE_CACHE_FAILED_OTHER: error_codes = 11; pub const error_codes_ERROR_CODES_INCORRECT_FILE_BUFFER_SIZE: error_codes = 12; +pub const error_codes_ERROR_CODES_TOO_SMALL_FILE_BUFFER: error_codes = 13; pub type error_codes = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/blackheap-benchmarker/src/lib.rs b/blackheap-benchmarker/src/lib.rs index 601dea0..739ff5a 100644 --- a/blackheap-benchmarker/src/lib.rs +++ b/blackheap-benchmarker/src/lib.rs @@ -10,6 +10,7 @@ pub enum AccessPattern { Const, Sequential, Random, + Reverse, } impl AccessPattern { @@ -18,6 +19,7 @@ impl AccessPattern { Self::Const => b::access_pattern_ACCESS_PATTERN_CONST, Self::Sequential => b::access_pattern_ACCESS_PATTERN_SEQUENTIAL, Self::Random => b::access_pattern_ACCESS_PATTERN_RANDOM, + Self::Reverse => b::access_pattern_ACCESS_PATTERN_REVERSE, } } @@ -26,6 +28,7 @@ impl AccessPattern { b::access_pattern_ACCESS_PATTERN_CONST => Self::Const, b::access_pattern_ACCESS_PATTERN_SEQUENTIAL => Self::Sequential, b::access_pattern_ACCESS_PATTERN_RANDOM => Self::Random, + b::access_pattern_ACCESS_PATTERN_REVERSE => Self::Reverse, _ => { panic!("Unknown Access Pattern! Probably forgot to update Rust to C logic"); } @@ -52,6 +55,7 @@ pub enum ErrorCodes { DropPageCacheFailedNoPermissions, DropPageCacheFailedOther, IncorrectFileBufferSize, + TooSmallFileBuffer, } impl ErrorCodes { @@ -74,6 +78,7 @@ impl ErrorCodes { b::error_codes_ERROR_CODES_DROP_PAGE_CACHE_FAILED_OTHER } Self::IncorrectFileBufferSize => b::error_codes_ERROR_CODES_INCORRECT_FILE_BUFFER_SIZE, + Self::TooSmallFileBuffer => b::error_codes_ERROR_CODES_TOO_SMALL_FILE_BUFFER, } }