Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Addressed issue #133
dealing with mismatching socket/core topolgoies in VM settings
  • Loading branch information
tawalaya committed Aug 19, 2022
commit e7553b01302b974bbff8706958eeab1dbe93aa72
15 changes: 12 additions & 3 deletions src/sensors/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,22 @@ impl Topology {
.unwrap()
.parse::<u16>()
.unwrap();
let socket = self
let socket_match = self
.sockets
.iter_mut()
.find(|x| &x.id == socket_id)
.expect("Trick: if you are running on a vm, do not forget to use --vm parameter invoking scaphandre at the command line");
.find(|x| &x.id == socket_id);

//In VMs there might be a missmatch betwen Sockets and Cores - see Issue#133 as a first fix we just map all cores that can't be mapped to the first
let socket = match socket_match {
Some(x) => x,
None =>self.sockets.first_mut().expect("Trick: if you are running on a vm, do not forget to use --vm parameter invoking scaphandre at the command line")
};

if socket_id == &socket.id {
socket.add_cpu_core(c);
} else {
socket.add_cpu_core(c);
warn!("coud't not match core to socket - mapping to first socket instead - if you are not using --vm there is something wrong")
}
}
}
Expand Down