Use main_core to determine slice

This commit is contained in:
augustin64 2024-06-27 11:31:21 +02:00
parent 989ae0c0ea
commit a17aeb33c7
3 changed files with 5 additions and 5 deletions

View File

@ -24,7 +24,7 @@ pub fn main() {
cpu_set.set(core).unwrap();
sched_setaffinity(Pid::this(), &cpu_set).unwrap();
for addr in target.iter() {
let slice = determine_slice(addr, nb_cores, Some(core));
let slice = determine_slice(addr as *const u64 as *const u8, core as u8, nb_cores);
match slice {
Some(slice) => {
println!("({:2}) Slice for addr {:x}: {}", core, addr as *const u64 as usize, slice)
@ -35,7 +35,7 @@ pub fn main() {
}
}
for addr in target.iter() {
let slice = determine_slice(addr, nb_cores, Some(0));
let slice = determine_slice(addr as *const u64 as *const u8, 0, nb_cores);
match slice {
Some(slice) => {
println!("({:2}) Slice for addr {:x}: {}", core, addr as *const u64 as usize, slice)

View File

@ -125,9 +125,9 @@ pub unsafe fn monitor_address(addr: *const u8, cpu: u8, max_cbox: u16) -> Result
}
}
pub fn determine_slice(addr: *const u8, nb_cores: u16, core: Option<u16>) -> Option<usize> {
pub fn determine_slice(addr: *const u8, core: u8, nb_cores: u16) -> Option<usize> {
let res = unsafe {
monitor_address(addr as *const u64 as *const u8, core.unwrap_or(0) as u8, nb_cores)
monitor_address(addr, core, nb_cores)
}.unwrap();
let slice = res.iter().enumerate().max_by_key(|(_i, val)| { **val });

View File

@ -219,7 +219,7 @@ fn calibrate_fixed_freq_2_thread_impl<I: Iterator<Item = (usize, usize)>, T>(
params.address = pointer;
//let hash = slicing.hash(pointer as usize);
let hash = determine_slice(pointer, nb_cores, None).unwrap();
let hash = determine_slice(pointer, main_core as u8, nb_cores).unwrap();
if options.verbosity >= Thresholds {
print!("Calibration for {:p}", pointer);