From 6aa5784e227d85ddaf8ed8257d76e8554027cf58 Mon Sep 17 00:00:00 2001 From: GuillaumeDIDIER Date: Thu, 16 Jul 2020 11:46:41 +0200 Subject: [PATCH] Add test program for complex addressing image and basis --- cache_utils/src/bin/cache_info.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cache_utils/src/bin/cache_info.rs b/cache_utils/src/bin/cache_info.rs index b8e30dc..bdf1163 100644 --- a/cache_utils/src/bin/cache_info.rs +++ b/cache_utils/src/bin/cache_info.rs @@ -1,5 +1,21 @@ use cache_utils::cache_info::get_cache_info; +use cache_utils::complex_addressing::cache_slicing; +use cpuid::MicroArchitecture; pub fn main() { println!("{:#?}", get_cache_info()); + + if let Some(uarch) = MicroArchitecture::get_micro_architecture() { + if let Some(vendor_family_model_stepping) = MicroArchitecture::get_family_model_stepping() { + let slicing = cache_slicing( + uarch, + 8, + vendor_family_model_stepping.0, + vendor_family_model_stepping.1, + vendor_family_model_stepping.2, + ); + println!("{:?}", slicing.image((1 << 12) - 1)); + println!("{:?}", slicing.kernel_compl_basis((1 << 12) - 1)); + } + } }