Compare commits

..

No commits in common. "a7ea11181f312e1d0e10cee2a2234cc6231903c5" and "f6494a82b2ba3cb69a0dbceef78ce81ab3065e10" have entirely different histories.

3 changed files with 8 additions and 12 deletions

View File

@ -18,11 +18,11 @@ pub(crate) fn determine_cpu_class() -> Option<CpuClass> {
// Todo, sift through the documentation to add support for more CPUs // Todo, sift through the documentation to add support for more CPUs
match (info.family_id(), info.model_id()) { match (info.family_id(), info.model_id()) {
(0x06, 0x2d) (0x06, 0x4f)
| (0x06, 0x2d)
| (0x06, 0x3e) | (0x06, 0x3e)
| (06, 0x3f) | (06, 0x3f)
| (0x06, 0x56) | (0x06, 0x56) => {
| (0x06, 0x4f) => {
Some(IntelXeon) Some(IntelXeon)
} }
(0x06, 0x55) => { (0x06, 0x55) => {
@ -62,7 +62,7 @@ pub(crate) fn get_performance_counters_xeon() -> Option<&'static XeonPerfCounter
0x2d /* 45 */ => Some(&SANDY_BRIDGE_XEON), 0x2d /* 45 */ => Some(&SANDY_BRIDGE_XEON),
0x3e /* 62 */ => Some(&IVY_BRIDGE_XEON), 0x3e /* 62 */ => Some(&IVY_BRIDGE_XEON),
0x3f /* 63 */ => Some(&HASWELL_XEON), 0x3f /* 63 */ => Some(&HASWELL_XEON),
0x4f | 0x56 /* 86 */ => Some(&BROADWELL_XEON), 0x56 /* 86 */ => Some(&BROADWELL_XEON),
_ => None, _ => None,
} }
} }

View File

@ -8,7 +8,7 @@ pub fn main() {
let nb_cores = core_per_package(); let nb_cores = core_per_package();
println!("Found {} cores", nb_cores); println!("Found {} cores", nb_cores);
let target = vec![0x0123456789abcdefu64; 64]; let target = vec![0x0123456789abcdefu64, 64];
let old = sched_getaffinity(Pid::from_raw(0)).unwrap(); let old = sched_getaffinity(Pid::from_raw(0)).unwrap();
let mut core_set = Vec::new(); let mut core_set = Vec::new();

View File

@ -49,7 +49,7 @@ unsafe fn monitor_xeon(addr: *const u8, cpu: u8, max_cbox: usize) -> Result<Vec<
// Reset counters // Reset counters
for i in 0..max_cbox { for i in 0..max_cbox {
write_msr_on_cpu(performance_counters.msr_pmon_box_ctl[i], cpu, performance_counters.val_box_reset)?; write_msr_on_cpu(performance_counters.msr_pmon_ctl0[i], cpu, performance_counters.val_box_reset)?;
} }
// Enable counting // Enable counting
@ -72,18 +72,14 @@ unsafe fn monitor_xeon(addr: *const u8, cpu: u8, max_cbox: usize) -> Result<Vec<
// Freeze counters // Freeze counters
for i in 0..max_cbox { for i in 0..max_cbox {
write_msr_on_cpu(performance_counters.msr_pmon_box_ctl[i], cpu, performance_counters.val_box_freeze)?; write_msr_on_cpu(performance_counters.msr_pmon_ctr0[i], cpu, performance_counters.val_box_freeze)?;
} }
// Read counters // Read counters
let mut results = Vec::new(); let mut results = Vec::new();
for i in 0..max_cbox { for i in 0..max_cbox {
let result = read_msr_on_cpu(performance_counters.msr_pmon_ctr0[i], cpu)?; let result = read_msr_on_cpu(performance_counters.msr_pmon_ctr0[i], cpu)?;
if (result - NUM_POKE as u64) < 0 { results.push(result)
results.push(0);
} else {
results.push(result - NUM_POKE as u64);
}
} }
Ok(results) Ok(results)