Skip to content

Instantly share code, notes, and snippets.

Created April 23, 2014 02:55
Show Gist options
  • Save anonymous/11201423 to your computer and use it in GitHub Desktop.
Save anonymous/11201423 to your computer and use it in GitHub Desktop.
cpus
extern crate libc;
macro_rules! trace(
($($arg:tt)*) => (
{ let x = ::std::io::stdout().write_line(format_args!(::std::fmt::format, $($arg)*)); println!("{}", x); }
);
)
pub fn num_cpus() -> uint {
unsafe {
return rust_get_num_cpus();
}
extern {
fn rust_get_num_cpus() -> libc::uintptr_t;
}
}
#[test]
fn test_this_thing() {
trace!("Cpus: {}", num_cpus());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment