diff --git a/cache_utils/src/cache_info.rs b/cache_utils/src/cache_info.rs index 8baa06a..a7519d4 100644 --- a/cache_utils/src/cache_info.rs +++ b/cache_utils/src/cache_info.rs @@ -31,12 +31,13 @@ pub enum CacheType { } #[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[allow(non_snake_case)] pub struct CacheInfo { pub cache_type: CacheType, pub level: u8, pub self_init: bool, pub fully_assoc: bool, - pub maxID_for_cache: u16, + pub max_ID_for_cache: u16, pub core_in_package: u16, pub cache_line_size: u16, pub physical_line_partition: u16, @@ -64,7 +65,8 @@ impl CacheInfo { let level: u8 = (cr.eax >> 5 & 0x7) as u8; let self_init = (cr.eax >> 8 & 0x1) != 0; let fully_assoc = (cr.eax >> 9 & 0x1) != 0; - let maxID_for_cache = (cr.eax >> 14 & 0xfff) as u16 + 1; + #[allow(non_snake_case)] + let max_ID_for_cache = (cr.eax >> 14 & 0xfff) as u16 + 1; let core_in_package = (cr.eax >> 26 & 0x3f) as u16 + 1; let cache_line_size = (cr.ebx & 0xfff) as u16 + 1; let physical_line_partition = (cr.ebx >> 12 & 0x3ff) as u16 + 1; @@ -79,7 +81,7 @@ impl CacheInfo { level, self_init, fully_assoc, - maxID_for_cache, + max_ID_for_cache, core_in_package, cache_line_size, physical_line_partition, diff --git a/cache_utils/src/prefetcher.rs b/cache_utils/src/prefetcher.rs index 6e2929a..d960505 100644 --- a/cache_utils/src/prefetcher.rs +++ b/cache_utils/src/prefetcher.rs @@ -30,21 +30,22 @@ pub fn enable_prefetchers(status: bool) { pub fn prefetcher_fun( victim_4k_addr: *mut u8, - victim_2M_addr: *mut u8, + #[allow(non_snake_case)] _victim_2M_addr: *mut u8, threshold_ff: u64, ) -> Vec { let mut results = vec![0; 4096 / 64]; - return results; - for _ in 0..N { - //unsafe { maccess(victim4kaddr) }; - for j in (0..4096).step_by(64).rev() { - let t = unsafe { only_flush(victim_4k_addr.offset(j)) }; - if threshold_ff < t { - // hit - results[(j / 64) as usize] += 1; - } else if threshold_ff > t { - results[(j / 64) as usize] -= 1; + if false { + for _ in 0..N { + //unsafe { maccess(victim4kaddr) }; + for j in (0..4096).step_by(64).rev() { + let t = unsafe { only_flush(victim_4k_addr.offset(j)) }; + if threshold_ff < t { + // hit + results[(j / 64) as usize] += 1; + } else if threshold_ff > t { + results[(j / 64) as usize] -= 1; + } } } }