#[inline]
pub fn is_supported() -> bool {
#[cfg(target_os = "linux")]
{
std::path::Path::new("/sys/devices/system/node/node0").exists()
}
#[cfg(not(target_os = "linux"))]
{
false
}
}
#[inline]
pub fn node_count() -> usize {
#[cfg(target_os = "linux")]
{
let mut count = 0;
while std::path::Path::new(&format!("/sys/devices/system/node/node{}", count)).exists() {
count += 1;
}
count
}
#[cfg(not(target_os = "linux"))]
{
1
}
}
#[inline]
pub fn current_node() -> Option<u32> {
#[cfg(target_os = "linux")]
{
Some(0)
}
#[cfg(not(target_os = "linux"))]
{
None
}
}
#[inline]
pub fn preferred_node() -> Option<u32> {
current_node()
}